1 | # |
---|
2 | # $Id$ |
---|
3 | # |
---|
4 | # top level directory for RTEMS build tree |
---|
5 | # This Makefile is *not* a good example of a directory Makefile. |
---|
6 | # |
---|
7 | |
---|
8 | @SET_MAKE@ |
---|
9 | srcdir = @srcdir@ |
---|
10 | top_srcdir = @top_srcdir@ |
---|
11 | top_builddir = .. |
---|
12 | subdir = c |
---|
13 | |
---|
14 | INSTALL = @INSTALL@ |
---|
15 | |
---|
16 | RTEMS_ROOT = $(top_srcdir)/@RTEMS_TOPdir@ |
---|
17 | PROJECT_ROOT = @PROJECT_ROOT@ |
---|
18 | |
---|
19 | prefix = @prefix@ |
---|
20 | exec_prefix = @exec_prefix@ |
---|
21 | bindir = @bindir@ |
---|
22 | libdir = @libdir@ |
---|
23 | includedir = @includedir@ |
---|
24 | target = @target@ |
---|
25 | manext = 1 |
---|
26 | mandir = @mandir@/man$(manext) |
---|
27 | program_prefix = @program_prefix@ |
---|
28 | VPATH = @srcdir@ |
---|
29 | |
---|
30 | include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg |
---|
31 | include $(RTEMS_ROOT)/make/directory.cfg |
---|
32 | |
---|
33 | SUB_DIRS=build-tools src |
---|
34 | |
---|
35 | # We only make the install point for the networking header files if needed. |
---|
36 | LIBNETWORKING_yes_V = lib/include/networking lib/include/networking/sys \ |
---|
37 | lib/include/networking/machine lib/include/networking/rtems \ |
---|
38 | lib/include/networking/vm lib/include/networking/net \ |
---|
39 | lib/include/networking/netinet lib/include/networking/arpa \ |
---|
40 | lib/include/networking/nfs |
---|
41 | LIBNETWORKING = $(LIBNETWORKING_$(HAS_NETWORKING)_V) |
---|
42 | |
---|
43 | # We only make the rpc install point if networking is enabled. |
---|
44 | LIBRPC_yes_V = lib/include/rpc |
---|
45 | LIBRPC = $(LIBRPC_$(HAS_NETWORKING)_V) |
---|
46 | |
---|
47 | # We only make the rdbg install point if networking and rdbg is enabled. |
---|
48 | LIBRDBG_yes_yes_V = lib/include/rdbg |
---|
49 | LIBRDBG = $(LIBRDBG_$(HAS_NETWORKING)_$(HAS_RDBG)_V) |
---|
50 | |
---|
51 | # We only make the rtems++ install point if it is enabled. |
---|
52 | LIBRTEMSCPLUSPLUS_yes_V = lib/include/rtems++ |
---|
53 | LIBRTEMSCPLUSPLUS = $(LIBRTEMSCPLUSPLUS_$(HAS_CPLUSPLUS)_V) |
---|
54 | |
---|
55 | # directories to be created in install point |
---|
56 | CREATE_DIRS = \ |
---|
57 | lib lib/include lib/include/sys lib/include/rtems \ |
---|
58 | lib/include/rtems/score lib/include/rtems/rtems lib/include/rtems/posix \ |
---|
59 | lib/include/libc lib/include/libc/sys \ |
---|
60 | lib/include/motorola lib/include/zilog \ |
---|
61 | lib/include/libchip \ |
---|
62 | $(LIBNETWORKING) \ |
---|
63 | $(LIBRPC) \ |
---|
64 | $(LIBRDBG) \ |
---|
65 | $(LIBRTEMSCPLUSPLUS) \ |
---|
66 | bin samples \ |
---|
67 | tests tests/screens tests/screens/sptests \ |
---|
68 | tests/screens/psxtests tests/screens/mptests \ |
---|
69 | tests/screens/mptests/node1 tests/screens/mptests/node2 \ |
---|
70 | build-tools update-tools |
---|
71 | |
---|
72 | BUILD_DIRS = ${CREATE_DIRS:%=$(PROJECT_ROOT)/$(RTEMS_BSP)/%} |
---|
73 | |
---|
74 | # Make all/install must include 'env' |
---|
75 | # if something is added to TARGET_VARIANTS, then account for it here |
---|
76 | make_src_makefiles: Makefile.in Makefile |
---|
77 | -find src -name Makefile \ |
---|
78 | -exec grep -l "^preinstall" {} \; | sort > make_src_makefiles.tmp |
---|
79 | -grep tools make_src_makefiles.tmp > make_src_makefiles |
---|
80 | -grep -v tools make_src_makefiles.tmp >> make_src_makefiles |
---|
81 | -rm make_src_makefiles.tmp |
---|
82 | |
---|
83 | pre_install_src: env make_src_makefiles |
---|
84 | cd build-tools/scripts; \ |
---|
85 | $(MAKE) RTEMS_BSP=${RTEMS_BSP} install-exec-local |
---|
86 | cd build-tools/src; \ |
---|
87 | $(MAKE) RTEMS_BSP=${RTEMS_BSP} install-exec-local |
---|
88 | @echo "Order of preinstall directories" |
---|
89 | cat make_src_makefiles |
---|
90 | @echo |
---|
91 | CURRDIR=`pwd`; \ |
---|
92 | for i in `cat make_src_makefiles` ; do \ |
---|
93 | DIR=`dirname $$i`; \ |
---|
94 | cd $$DIR; \ |
---|
95 | $(MAKE) RTEMS_BSP=${RTEMS_BSP} preinstall; \ |
---|
96 | cd $$CURRDIR; \ |
---|
97 | done |
---|
98 | |
---|
99 | all: pre_install_src env |
---|
100 | debug: pre_install_src env |
---|
101 | profile: pre_install_src env |
---|
102 | |
---|
103 | install: all install_files |
---|
104 | debug_install: env debug install_files |
---|
105 | profile_install: env profile install_files |
---|
106 | |
---|
107 | debug_all: debug |
---|
108 | profile_all: profile |
---|
109 | |
---|
110 | # top level clean/clobber will delete the install points |
---|
111 | clean_WRAPUP = $(MAKE) clean_wrapup |
---|
112 | clobber_WRAPUP = $(MAKE) clean_wrapup |
---|
113 | |
---|
114 | clean_wrapup: clean_tools clean_dirs clean_modules |
---|
115 | |
---|
116 | .PHONY: dirs clean_wrapup clean_dirs clean_tools clean_modules env install |
---|
117 | |
---|
118 | $(BUILD_DIRS): |
---|
119 | $(RTEMS_ROOT)/mkinstalldirs $(BUILD_DIRS) |
---|
120 | if test -d $(PROJECT_ROOT)/c/src/lib/libhwapi; then \ |
---|
121 | (cd $(PROJECT_ROOT)/c/src/lib/libhwapi ; $(MAKE) mkdirs) \ |
---|
122 | fi |
---|
123 | |
---|
124 | dirs: $(BUILD_DIRS) |
---|
125 | |
---|
126 | distclean: clobber |
---|
127 | |
---|
128 | clean_dirs: |
---|
129 | $(RM) -r $(PROJECT_RELEASE) |
---|
130 | |
---|
131 | clean_tools: |
---|
132 | cd build-tools; $(MAKE) clean |
---|
133 | |
---|
134 | $(PROJECT_ROOT)/$(RTEMS_BSP)/Makefile.inc: $(PROJECT_ROOT)/make/Templates/Makefile.inc |
---|
135 | echo "RTEMS_BSP = $(RTEMS_BSP)" > $@ |
---|
136 | $(CAT) $< >> $@ |
---|
137 | |
---|
138 | # NOTE: The wildcard on the install should pick up everything except |
---|
139 | # the tests directory. This significantly minimizes the install size. |
---|
140 | |
---|
141 | install_files: $(PROJECT_ROOT)/$(RTEMS_BSP)/Makefile.inc |
---|
142 | @top_srcdir@/mkinstalldirs $(prefix) |
---|
143 | -$(RM) -rf $(prefix)/$(RTEMS_BSP) |
---|
144 | cd ../; tar cf - $(RTEMS_BSP)/[bilsuM]* | \ |
---|
145 | (cd $(prefix); tar xpBf - ) |
---|
146 | cd ../make; $(MAKE) RTEMS_BSP=$(RTEMS_BSP) install |
---|
147 | |
---|
148 | tests: |
---|
149 | cd src/tests; $(MAKE) all |
---|
150 | |
---|
151 | debug_tests: debug |
---|
152 | cd src/tests; $(MAKE) debug |
---|
153 | |
---|
154 | profile_tests: profile |
---|
155 | cd src/tests; $(MAKE) profile |
---|
156 | |
---|
157 | env: $(SRCS) dirs |
---|
158 | |
---|
159 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
---|
160 | cd $(top_builddir) \ |
---|
161 | && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status |
---|