|
|
1.1 root 1: # Makefile for GNU Mach.
2:
3: # Copyright (C) 2006, 2007, 2008, 2009, 2013 Free Software Foundation, Inc.
4:
5: # This program is free software; you can redistribute it and/or modify it
6: # under the terms of the GNU General Public License as published by the
7: # Free Software Foundation; either version 2, or (at your option) any later
8: # version.
9: #
10: # This program is distributed in the hope that it will be useful, but
11: # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: # for more details.
14: #
15: # You should have received a copy of the GNU General Public License along
16: # with this program; if not, write to the Free Software Foundation, Inc.,
17: # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18:
19: #
20: # Various definitions of the Automake environment.
21: #
22: # These will be augmented below.
23: #
24:
25: SUBDIRS =
26: DIST_SUBDIRS =
27: EXTRA_DIST =
28: DISTCHECK_CONFIGURE_FLAGS =
29: noinst_LIBRARIES =
30: noinst_PROGRAMS =
31: TESTS=
32: info_TEXINFOS =
33: MOSTLYCLEANFILES =
34: DISTCLEANFILES =
35: AM_CPPFLAGS =
36: AM_CCASFLAGS =
37: AM_CFLAGS =
38: AM_LDFLAGS =
39:
40: #
41: # Compilation flags
42: #
43:
44: AM_CPPFLAGS += \
45: -nostdinc -imacros config.h
46:
47: AM_CPPFLAGS += \
48: -I$(systype) \
49: -I. \
50: -I$(top_srcdir)/$(systype) \
51: -I$(top_srcdir)/$(systype)/include/mach/sa \
52: -I$(top_srcdir)/include
53:
54: AM_CFLAGS += \
55: -fno-builtin-log
56:
57: # Yes, this makes the eyes hurt. But perhaps someone will finally take care of
58: # all that scruffy Mach code... Also see <http://savannah.gnu.org/task/?5726>.
59: AM_CFLAGS += \
60: -Wall
61:
62: # See <http://lists.gnu.org/archive/html/bug-hurd/2006-01/msg00148.html>.
63: AM_CFLAGS += \
64: -fno-strict-aliasing
65:
66: # The smashing stack protector might be enabled by default, but might emit
67: # unsuitable code.
68: if disable_smashing_stack_protector
69: AM_CFLAGS += \
70: -fno-stack-protector
71: endif
72:
73: #
74: # Silent build support.
75: #
76:
77: AWK_V = $(AWK_V_$(V))
78: AWK_V_ = $(AWK_V_$(AM_DEFAULT_VERBOSITY))
79: AWK_V_0 = @echo " AWK $@";
80:
81: GZIP_V = $(GZIP_V_$(V))
82: GZIP_V_ = $(GZIP_V_$(AM_DEFAULT_VERBOSITY))
83: GZIP_V_0 = @echo " GZIP $@";
84:
85: NM_V = $(NM_V_$(V))
86: NM_V_ = $(NM_V_$(AM_DEFAULT_VERBOSITY))
87: NM_V_0 = @echo " NM $@";
88:
89: MIGCOM_V = $(MIGCOM_V_$(V))
90: MIGCOM_V_ = $(MIGCOM_V_$(AM_DEFAULT_VERBOSITY))
91: MIGCOM_V_0 = @echo " MIG $@";
92:
93: #
94: # MIG Setup.
95: #
96:
97: # MIGCOM.
98: MIGCOM = $(MIG) -n -cc cat - /dev/null
99:
100: # We need this because we use $(CPP) to preprocess MIG .defs files.
101: CPP = @CPP@ -x c
102:
103: #
104: # Other Tools' Configuration.
105: #
106:
107: # Don't needlessly overwrite files that whose contents haven't changed. This
108: # helps for avoinding unneccessary recompilation cycles when keeping
109: # cross-compilation toolchains up-to-date. Thus, unconditionally use the
110: # `install-sh' that is supplied by GNU Automake 1.10.1, as the GNU Coreutils
111: # one doesn't provide this functionality yet (TODO: change that). TODO:
112: # `build-aux' is hardcoded.
113: install_sh = $(SHELL) $(abs_srcdir)/build-aux/install-sh -C
114: INSTALL = $(install_sh)
115:
116: #
117: # The main kernel functionality.
118: #
119:
120: noinst_LIBRARIES += \
121: libkernel.a
122: libkernel_a_SOURCES =
123: nodist_libkernel_a_SOURCES =
124: MOSTLYCLEANFILES += \
125: $(nodist_libkernel_a_SOURCES)
126:
127: gnumach_o_LDADD = \
128: libkernel.a
129:
130: gnumach_SOURCES =
131: gnumach_LINKFLAGS =
132:
133: # Makerules: how to do some things.
134: include Makerules.am
135:
136: # Main Makefile fragment.
137: include Makefrag.am
138:
139: # Test suite.
140: include tests/Makefrag.am
141:
142: # Documentation.
143: include doc/Makefrag.am
144:
145: #
146: # Kernel Image
147: #
148:
149: # We need the following junk because of the include-files-from-libc.a magic.
150: # TODO. Is the following kosher from a Automake point of view? (I.e. a
151: # program `gnumach.o' that is then later used again as an object file.)
152: gnumach_o_SOURCES =
153: # TODO. ``-u _start''. System dependent?
154: gnumach_o_LINK = $(LD) -u _start -r -o $@
155: noinst_PROGRAMS += \
156: gnumach.o
157:
158: # This is the list of routines we decide is OK to steal from the C library.
159: clib_routines := memcmp memcpy memmove \
160: strchr strstr strsep strtok \
161: htonl htons ntohl ntohs \
162: udivdi3 __udivdi3 \
163: __rel_iplt_start __rel_iplt_end \
164: _START _start etext _edata end _end # actually ld magic, not libc.
165: gnumach-undef: gnumach.$(OBJEXT)
166: $(NM_V) $(NM) -u $< | sed 's/ *U *//' | sort -u > $@
167: MOSTLYCLEANFILES += gnumach-undef
168: gnumach-undef-bad: gnumach-undef Makefile
169: $(AM_V_GEN) sed '$(foreach r,$(clib_routines),/^$r$$/d;)' $< > $@
170: MOSTLYCLEANFILES += gnumach-undef-bad
171: clib-routines.o: gnumach-undef gnumach-undef-bad
172: $(AM_V_at) if test -s gnumach-undef-bad; \
173: then cat gnumach-undef-bad; exit 2; else true; fi
174: $(AM_V_CCLD) $(CCLD) -nostdlib -nostartfiles -r -static \
175: -o $@ `sed 's/^/-Wl,-u,/' < $<` -x c /dev/null -lc -lgcc
176:
177: gnumach_LINK = $(LD) $(LINKFLAGS) $(gnumach_LINKFLAGS) -o $@
178: gnumach_LDADD = gnumach.o clib-routines.o
179:
180: #
181: # Installation.
182: #
183:
184: exec_bootdir = \
185: $(exec_prefix)/boot
186: exec_boot_PROGRAMS = \
187: gnumach
188:
189: #
190: # Building a distribution.
191: #
192:
193: EXTRA_DIST += \
194: config.status.dep.patch
195:
196: EXTRA_DIST += \
197: DEVELOPMENT
198:
199: dist-hook: dist-rm-CVS gen-ChangeLog
200:
201: .PHONY: dist-rm-CVS
202: dist-rm-CVS:
203: # Try to be very safe with respect to spuriously removing various directories
204: # in case of an error.
205: find $(distdir)/ -type d -name CVS | while read d; do \
206: rm -f "$$d"/{Entries,Repository,Root,Tag} && \
207: rmdir "$$d"; \
208: done
209:
210: gen_start_commit = e227045b06d62ee7d2fbab9d5ade9030ff43170b
211: ChangeLog_files = ChangeLog ChangeLog.0 ChangeLog.00
212: .PHONY: gen-ChangeLog
213: gen-ChangeLog:
214: $(AM_V_GEN)if test -d $(top_srcdir)/.git; then \
215: (cd $(top_srcdir)/ && \
216: ./gitlog-to-changelog --strip-tab \
217: $(gen_start_commit).. && \
218: echo) >> $(distdir)/cl-t && \
219: for f in $(ChangeLog_files); do \
220: (cd $(top_srcdir)/ && \
221: git show $(gen_start_commit):$$f) >> $(distdir)/cl-t && \
222: rm -f $(distdir)/$$f && \
223: mv $(distdir)/cl-t $(distdir)/$$f \
224: || exit $$?; \
225: done; \
226: fi
227:
228: DISTCLEANFILES += \
229: Makefile.orig \
230: config.status.orig
231:
232: #
233: # Legacy support.
234: #
235:
236: install-headers: install-data
237: @echo '*****************************************************'
238: @echo '* As you can see above, I was so kind to rewrite your'
239: @echo '* `make $@'\'
240: @echo '* into'
241: @echo '* `make $^'\'
242: @echo '* which is how it is to be spelled these days.'
243: @echo '*'
244: @echo '* Please get your instructions fixed.'
245: @echo '*****************************************************'
246: @echo
247: @echo 'Penalty:'
248: sleep 20
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.