ea685e2adeb36ab6a5e3dd399de45209a8919237
[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_guts.c \
28         yaffs_packedtags1.c \
29         yaffs_tagscompat.c \
30         yaffs_packedtags2.c \
31         yaffs_nand.c \
32         yaffs_checkptrw.c \
33         yaffs_nameval.c \
34         yaffs_allocator.c \
35         yaffs_bitmap.c \
36         yaffs_yaffs1.c \
37         yaffs_yaffs2.c \
38         yaffs_verify.c \
39         yaffs_summary.c \
40         yaffs_ecc.h \
41         yaffs_guts.h \
42         yaffs_packedtags1.h \
43         yaffs_tagscompat.h \
44         yaffs_packedtags2.h \
45         yaffs_nand.h \
46         yaffs_checkptrw.h \
47         yaffs_nameval.h \
48         yaffs_attribs.h \
49         yaffs_allocator.h \
50         yaffs_bitmap.h \
51         yaffs_yaffs1.h \
52         yaffs_yaffs2.h \
53         yaffs_verify.h \
54         yaffs_summary.h \
55         yaffs_trace.h \
56         yaffs_endian.h \
57         yaffs_getblockinfo.h \
58         yaffs_tagsmarshall.h
59
60
61 DIRECT_SYMLINKS = \
62         yaffs_attribs.c \
63         yaffs_hweight.c \
64         yaffs_hweight.h \
65         yportenv.h \
66         ydirectenv.h \
67         yaffscfg.h \
68         yaffs_osglue.h \
69         yaffs_list.h \
70         yaffsfs.h
71
72 DIRECT_QSORT_SYMLINKS = \
73         qsort.c
74
75 ALL_SYMLINKS = $(YCORE_SYMLINKS) $(DIRECT_SYMLINKS) $(DIRECT_QSORT_SYMLINKS)
76
77
78 INCLUDES = rtems_yaffs.h \
79         yportenv.h \
80         ydirectenv.h \
81         yaffs_osglue.h \
82         yaffs_hweight.h \
83         yaffscfg.h \
84         yaffs_list.h \
85         yaffsfs.h \
86         yaffs_guts.h \
87         yaffs_packedtags2.h \
88         yaffs_ecc.h
89
90 LIB = $(BUILDDIR)/libyaffs2.a
91 LIB_PIECES = yaffs_ecc \
92         yaffs_guts \
93         yaffs_packedtags1 \
94         yaffs_tagscompat \
95         yaffs_packedtags2 \
96         yaffs_nand \
97         yaffs_checkptrw \
98         qsort \
99         yaffs_nameval \
100         yaffs_attribs \
101         yaffs_allocator \
102         yaffs_bitmap \
103         yaffs_yaffs1 \
104         yaffs_yaffs2 \
105         yaffs_verify \
106         yaffs_summary \
107         yaffs_hweight \
108         rtems_yaffs \
109         rtems_yaffs_os_context \
110         rtems_yaffs_os_glue
111 LIB_OBJS = $(LIB_PIECES:%=$(BUILDDIR)/%.o)
112 LIB_DEPS = $(LIB_PIECES:%=$(BUILDDIR)/%.d)
113
114 all: $(BUILDDIR) $(ALL_SYMLINKS) $(LIB)
115
116 symlinks:$(ALL_SYMLINKS)
117
118 $(YCORE_SYMLINKS): 
119         ln -s ../$@ $@
120
121 $(DIRECT_SYMLINKS): 
122         ln -s ../direct/$@ $@
123
124 $(DIRECT_QSORT_SYMLINKS): 
125         ln -s ../direct/optional_sort/$@ $@
126
127 $(BUILDDIR):
128         mkdir $(BUILDDIR)
129
130 $(LIB): $(LIB_OBJS)
131         $(AR) rcu $@ $^
132         $(RANLIB) $@
133
134 $(BUILDDIR)/%.o: %.c
135         $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
136
137 clean:
138         rm -rf $(BUILDDIR) $(ALL_SYMLINKS)
139
140 install:  all
141         mkdir -p $(INSTALL_BASE)/include/yaffs
142         install -m 644 $(LIB) $(INSTALL_BASE)
143         install -m 644 $(INCLUDES) $(INSTALL_BASE)/include/yaffs
144
145 .PHONY: clean install
146
147 -include $(LIB_DEPS)