|
|
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 += \
1.1.1.4 root 45: -ffreestanding -nostdinc -imacros config.h
1.1 root 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:
1.1.1.3 root 62: # We need the GNU-style inline
1.1 root 63: AM_CFLAGS += \
1.1.1.3 root 64: -fgnu89-inline
1.1 root 65:
1.1.1.4 root 66: # Much of the Mach code predates C99 and makes invalid assumptions about
67: # type punning.
68: AM_CFLAGS += \
69: -fno-strict-aliasing
70:
1.1 root 71: # The smashing stack protector might be enabled by default, but might emit
72: # unsuitable code.
73: if disable_smashing_stack_protector
74: AM_CFLAGS += \
75: -fno-stack-protector
76: endif
77:
78: #
79: # Silent build support.
80: #
81:
82: AWK_V = $(AWK_V_$(V))
83: AWK_V_ = $(AWK_V_$(AM_DEFAULT_VERBOSITY))
84: AWK_V_0 = @echo " AWK $@";
85:
86: GZIP_V = $(GZIP_V_$(V))
87: GZIP_V_ = $(GZIP_V_$(AM_DEFAULT_VERBOSITY))
88: GZIP_V_0 = @echo " GZIP $@";
89:
90: NM_V = $(NM_V_$(V))
91: NM_V_ = $(NM_V_$(AM_DEFAULT_VERBOSITY))
92: NM_V_0 = @echo " NM $@";
93:
94: MIGCOM_V = $(MIGCOM_V_$(V))
95: MIGCOM_V_ = $(MIGCOM_V_$(AM_DEFAULT_VERBOSITY))
96: MIGCOM_V_0 = @echo " MIG $@";
97:
98: #
99: # MIG Setup.
100: #
101:
102: # MIGCOM.
103: MIGCOM = $(MIG) -n -cc cat - /dev/null
104:
105: # We need this because we use $(CPP) to preprocess MIG .defs files.
106: CPP = @CPP@ -x c
107:
108: #
109: # Other Tools' Configuration.
110: #
111:
1.1.1.2 root 112: # Don't needlessly overwrite files whose contents haven't changed.
113: # This helps avoiding unnecessary recompilation cycles when keeping
1.1 root 114: # cross-compilation toolchains up-to-date. Thus, unconditionally use the
115: # `install-sh' that is supplied by GNU Automake 1.10.1, as the GNU Coreutils
116: # one doesn't provide this functionality yet (TODO: change that). TODO:
117: # `build-aux' is hardcoded.
118: install_sh = $(SHELL) $(abs_srcdir)/build-aux/install-sh -C
119: INSTALL = $(install_sh)
120:
121: #
122: # The main kernel functionality.
123: #
124:
125: noinst_LIBRARIES += \
126: libkernel.a
127: libkernel_a_SOURCES =
128: nodist_libkernel_a_SOURCES =
129: MOSTLYCLEANFILES += \
130: $(nodist_libkernel_a_SOURCES)
131:
132: gnumach_o_LDADD = \
133: libkernel.a
134:
135: gnumach_SOURCES =
136: gnumach_LINKFLAGS =
137:
138: # Makerules: how to do some things.
139: include Makerules.am
140:
141: # Main Makefile fragment.
142: include Makefrag.am
143:
144: # Test suite.
145: include tests/Makefrag.am
146:
147: # Documentation.
148: include doc/Makefrag.am
149:
150: #
151: # Kernel Image
152: #
153:
154: # We need the following junk because of the include-files-from-libc.a magic.
155: # TODO. Is the following kosher from a Automake point of view? (I.e. a
156: # program `gnumach.o' that is then later used again as an object file.)
157: gnumach_o_SOURCES =
158: # TODO. ``-u _start''. System dependent?
1.1.1.5 ! root 159: gnumach_o_LINK = $(LD) $(LDFLAGS) -u _start -r -o $@
1.1 root 160: noinst_PROGRAMS += \
161: gnumach.o
162:
163: # This is the list of routines we decide is OK to steal from the C library.
1.1.1.5 ! root 164: clib_routines := htonl htons ntohl ntohs \
1.1.1.3 root 165: udivdi3 __udivdi3 __umoddi3 \
1.1 root 166: __rel_iplt_start __rel_iplt_end \
1.1.1.3 root 167: __ffsdi2 \
1.1 root 168: _START _start etext _edata end _end # actually ld magic, not libc.
169: gnumach-undef: gnumach.$(OBJEXT)
170: $(NM_V) $(NM) -u $< | sed 's/ *U *//' | sort -u > $@
171: MOSTLYCLEANFILES += gnumach-undef
172: gnumach-undef-bad: gnumach-undef Makefile
173: $(AM_V_GEN) sed '$(foreach r,$(clib_routines),/^$r$$/d;)' $< > $@
174: MOSTLYCLEANFILES += gnumach-undef-bad
175: clib-routines.o: gnumach-undef gnumach-undef-bad
176: $(AM_V_at) if test -s gnumach-undef-bad; \
177: then cat gnumach-undef-bad; exit 2; else true; fi
1.1.1.5 ! root 178: $(AM_V_CCLD) $(CCLD) $(LDFLAGS) -nostdlib -nostartfiles -r -static \
1.1 root 179: -o $@ `sed 's/^/-Wl,-u,/' < $<` -x c /dev/null -lc -lgcc
1.1.1.2 root 180: @if nm $@ | grep __init_cpu_features; \
181: then echo "Please install a 32bit libc without multiarch support (on Debian systems, the libc6-dev:i386 package containing /usr/lib/i386-linux-gnu/libc.a)". ; \
182: false ; fi
1.1 root 183:
1.1.1.5 ! root 184: gnumach_LINK = $(LD) $(LDFLAGS) $(LINKFLAGS) $(gnumach_LINKFLAGS) -o $@
1.1 root 185: gnumach_LDADD = gnumach.o clib-routines.o
186:
187: #
188: # Installation.
189: #
190:
191: exec_bootdir = \
192: $(exec_prefix)/boot
193: exec_boot_PROGRAMS = \
194: gnumach
195:
196: #
197: # Building a distribution.
198: #
199:
200: EXTRA_DIST += \
201: config.status.dep.patch
202:
203: EXTRA_DIST += \
204: DEVELOPMENT
205:
206: dist-hook: dist-rm-CVS gen-ChangeLog
207:
208: .PHONY: dist-rm-CVS
209: dist-rm-CVS:
210: # Try to be very safe with respect to spuriously removing various directories
211: # in case of an error.
212: find $(distdir)/ -type d -name CVS | while read d; do \
213: rm -f "$$d"/{Entries,Repository,Root,Tag} && \
214: rmdir "$$d"; \
215: done
216:
217: gen_start_commit = e227045b06d62ee7d2fbab9d5ade9030ff43170b
218: ChangeLog_files = ChangeLog ChangeLog.0 ChangeLog.00
219: .PHONY: gen-ChangeLog
220: gen-ChangeLog:
221: $(AM_V_GEN)if test -d $(top_srcdir)/.git; then \
222: (cd $(top_srcdir)/ && \
223: ./gitlog-to-changelog --strip-tab \
224: $(gen_start_commit).. && \
225: echo) >> $(distdir)/cl-t && \
226: for f in $(ChangeLog_files); do \
227: (cd $(top_srcdir)/ && \
228: git show $(gen_start_commit):$$f) >> $(distdir)/cl-t && \
229: rm -f $(distdir)/$$f && \
230: mv $(distdir)/cl-t $(distdir)/$$f \
231: || exit $$?; \
232: done; \
233: fi
234:
235: DISTCLEANFILES += \
236: Makefile.orig \
237: config.status.orig
238:
239: #
240: # Legacy support.
241: #
242:
243: install-headers: install-data
244: @echo '*****************************************************'
245: @echo '* As you can see above, I was so kind to rewrite your'
246: @echo '* `make $@'\'
247: @echo '* into'
248: @echo '* `make $^'\'
249: @echo '* which is how it is to be spelled these days.'
250: @echo '*'
251: @echo '* Please get your instructions fixed.'
252: @echo '*****************************************************'
253: @echo
254: @echo 'Penalty:'
255: sleep 20
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.