Merge branch 'time_upgrade'
[yaffs2.git] / rtems / Makefile.rtems
1 #
2 # This file was originally written to work from the yaffs2 base directory
3 # which required deleting some of the Linux files.
4 #
5 # This is now modified to run from the yaffs2/rtems directory and copies in
6 # all files as symbolic links.
7 #
8
9 include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
10 include $(RTEMS_MAKEFILE_PATH)/make/target.cfg
11
12 INSTALL_BASE = $(RTEMS_MAKEFILE_PATH)/lib
13
14 BUILDDIR = build-$(RTEMS_BSP)
15
16 CPPFLAGS += -I. 
17
18 DEPFLAGS = -MT $@ -MD -MP -MF $(basename $@).d
19
20 GCCFLAGS = -g -I . -B $(INSTALL_BASE) -specs bsp_specs -qrtems
21
22 CFLAGS += $(DEPFLAGS) $(GCCFLAGS)
23
24 # Files to be made into local symlinks
25 YCORE_SYMLINKS = \
26         yaffs_ecc.c \
27         yaffs_cache.c \
28         yaffs_endian.c \
29         yaffs_guts.c \
30         yaffs_packedtags1.c \
31         yaffs_tagscompat.c \
32         yaffs_packedtags2.c \
33         yaffs_nand.c \
34         yaffs_checkptrw.c \
35         yaffs_nameval.c \
36         yaffs_allocator.c \
37         yaffs_bitmap.c \
38         yaffs_yaffs1.c \
39         yaffs_yaffs2.c \
40         yaffs_verify.c \
41         yaffs_summary.c \
42         yaffs_tagsmarshall.c\
43         yaffs_cache.h \
44         yaffs_ecc.h \
45         yaffs_guts.h \
46         yaffs_packedtags1.h \
47         yaffs_tagscompat.h \
48         yaffs_packedtags2.h \
49         yaffs_nand.h \
50         yaffs_checkptrw.h \
51         yaffs_nameval.h \
52         yaffs_attribs.h \
53         yaffs_allocator.h \
54         yaffs_bitmap.h \
55         yaffs_yaffs1.h \
56         yaffs_yaffs2.h \
57         yaffs_verify.h \
58         yaffs_summary.h \
59         yaffs_trace.h \
60         yaffs_endian.h \
61         yaffs_getblockinfo.h \
62         yaffs_tagsmarshall.h
63
64
65 DIRECT_SYMLINKS = \
66         yaffs_attribs.c \
67         yaffs_hweight.c \
68         yaffs_hweight.h \
69         yportenv.h \
70         ydirectenv.h \
71         yaffscfg.h \
72         yaffs_osglue.h \
73         yaffs_list.h \
74         yaffsfs.h
75
76 DIRECT_QSORT_SYMLINKS = \
77         qsort.c
78
79 ALL_SYMLINKS = $(YCORE_SYMLINKS) $(DIRECT_SYMLINKS) $(DIRECT_QSORT_SYMLINKS)
80
81
82 INCLUDES = rtems_yaffs.h \
83         yportenv.h \
84         ydirectenv.h \
85         yaffs_osglue.h \
86         yaffs_hweight.h \
87         yaffscfg.h \
88         yaffs_list.h \
89         yaffsfs.h \
90         yaffs_guts.h \
91         yaffs_packedtags2.h \
92         yaffs_ecc.h
93
94 LIB = $(BUILDDIR)/libyaffs2.a
95 LIB_PIECES = yaffs_ecc \
96         yaffs_endian \
97         yaffs_guts \
98         yaffs_cache \
99         yaffs_packedtags1 \
100         yaffs_tagscompat \
101         yaffs_tagsmarshall\
102         yaffs_packedtags2 \
103         yaffs_nand \
104         yaffs_checkptrw \
105         qsort \
106         yaffs_nameval \
107         yaffs_attribs \
108         yaffs_allocator \
109         yaffs_bitmap \
110         yaffs_yaffs1 \
111         yaffs_yaffs2 \
112         yaffs_verify \
113         yaffs_summary \
114         yaffs_hweight \
115         rtems_yaffs \
116         rtems_yaffs_os_context \
117         rtems_yaffs_os_glue
118 LIB_OBJS = $(LIB_PIECES:%=$(BUILDDIR)/%.o)
119 LIB_DEPS = $(LIB_PIECES:%=$(BUILDDIR)/%.d)
120
121 all: $(BUILDDIR) $(ALL_SYMLINKS) $(LIB)
122
123 symlinks:$(ALL_SYMLINKS)
124
125 $(YCORE_SYMLINKS): 
126         ln -s ../$@ $@
127
128 $(DIRECT_SYMLINKS): 
129         ln -s ../direct/$@ $@
130
131 $(DIRECT_QSORT_SYMLINKS): 
132         ln -s ../direct/optional_sort/$@ $@
133
134 $(BUILDDIR):
135         mkdir $(BUILDDIR)
136
137 $(LIB): $(LIB_OBJS)
138         $(AR) rcu $@ $^
139         $(RANLIB) $@
140
141 $(BUILDDIR)/%.o: %.c
142         $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
143
144 clean:
145         rm -rf $(BUILDDIR) $(ALL_SYMLINKS)
146
147 install:  all
148         mkdir -p $(INSTALL_BASE)/include/yaffs
149         install -m 644 $(LIB) $(INSTALL_BASE)
150         install -m 644 $(INCLUDES) $(INSTALL_BASE)/include/yaffs
151
152 .PHONY: clean install
153
154 -include $(LIB_DEPS)