Import rtems wrapper from rtems git
[yaffs2.git] / Makefile.rtems
1 include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
2 include $(RTEMS_MAKEFILE_PATH)/make/target.cfg
3
4 INSTALL_BASE = $(RTEMS_MAKEFILE_PATH)/lib
5
6 BUILDDIR = build-$(RTEMS_BSP)
7
8 CPPFLAGS += -I. -Idirect -Idirect/rtems
9
10 DEPFLAGS = -MT $@ -MD -MP -MF $(basename $@).d
11
12 GCCFLAGS = -g -I . -B $(INSTALL_BASE) -specs bsp_specs -qrtems
13
14 CFLAGS += $(DEPFLAGS) $(GCCFLAGS)
15
16 INCLUDES = rtems/rtems_yaffs.h \
17         direct/yportenv.h \
18         direct/ydirectenv.h \
19         direct/yaffs_osglue.h \
20         direct/yaffs_hweight.h \
21         direct/yaffscfg.h \
22         direct/yaffs_list.h \
23         direct/yaffsfs.h \
24         yaffs_guts.h \
25         yaffs_packedtags2.h \
26         yaffs_ecc.h
27
28 LIB = $(BUILDDIR)/libyaffs2.a
29 LIB_PIECES = yaffs_ecc \
30         yaffs_guts \
31         yaffs_packedtags1 \
32         yaffs_tagscompat \
33         yaffs_packedtags2 \
34         yaffs_nand \
35         yaffs_checkptrw \
36         direct/yaffs_qsort \
37         yaffs_nameval \
38         yaffs_attribs \
39         yaffs_allocator \
40         yaffs_bitmap \
41         yaffs_yaffs1 \
42         yaffs_yaffs2 \
43         yaffs_verify \
44         yaffs_summary \
45         direct/yaffs_hweight \
46         rtems/rtems_yaffs \
47         rtems/rtems_yaffs_os_context \
48         rtems/rtems_yaffs_os_glue
49 LIB_OBJS = $(LIB_PIECES:%=$(BUILDDIR)/%.o)
50 LIB_DEPS = $(LIB_PIECES:%=$(BUILDDIR)/%.d)
51
52 all: $(BUILDDIR) $(LIB)
53
54 $(BUILDDIR):
55         mkdir $(BUILDDIR)
56         mkdir $(BUILDDIR)/direct
57         mkdir $(BUILDDIR)/rtems
58
59 $(LIB): $(LIB_OBJS)
60         $(AR) rcu $@ $^
61         $(RANLIB) $@
62
63 $(BUILDDIR)/%.o: %.c
64         $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
65
66 clean:
67         rm -rf $(BUILDDIR)
68
69 install:  all
70         mkdir -p $(INSTALL_BASE)/include/yaffs
71         install -m 644 $(LIB) $(INSTALL_BASE)
72         install -m 644 $(INCLUDES) $(INSTALL_BASE)/include/yaffs
73
74 .PHONY: clean install
75
76 -include $(LIB_DEPS)