|
|
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?
159: gnumach_o_LINK = $(LD) -u _start -r -o $@
160: noinst_PROGRAMS += \
161: gnumach.o
162:
163: # This is the list of routines we decide is OK to steal from the C library.
164: clib_routines := memcmp memcpy memmove \
165: strchr strstr strsep strtok \
166: htonl htons ntohl ntohs \
1.1.1.3 root 167: udivdi3 __udivdi3 __umoddi3 \
1.1 root 168: __rel_iplt_start __rel_iplt_end \
1.1.1.3 root 169: __ffsdi2 \
1.1 root 170: _START _start etext _edata end _end # actually ld magic, not libc.
171: gnumach-undef: gnumach.$(OBJEXT)
172: $(NM_V) $(NM) -u $< | sed 's/ *U *//' | sort -u > $@
173: MOSTLYCLEANFILES += gnumach-undef
174: gnumach-undef-bad: gnumach-undef Makefile
175: $(AM_V_GEN) sed '$(foreach r,$(clib_routines),/^$r$$/d;)' $< > $@
176: MOSTLYCLEANFILES += gnumach-undef-bad
177: clib-routines.o: gnumach-undef gnumach-undef-bad
178: $(AM_V_at) if test -s gnumach-undef-bad; \
179: then cat gnumach-undef-bad; exit 2; else true; fi
180: $(AM_V_CCLD) $(CCLD) -nostdlib -nostartfiles -r -static \
181: -o $@ `sed 's/^/-Wl,-u,/' < $<` -x c /dev/null -lc -lgcc
1.1.1.2 root 182: @if nm $@ | grep __init_cpu_features; \
183: 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)". ; \
184: false ; fi
1.1 root 185:
186: gnumach_LINK = $(LD) $(LINKFLAGS) $(gnumach_LINKFLAGS) -o $@
187: gnumach_LDADD = gnumach.o clib-routines.o
188:
189: #
190: # Installation.
191: #
192:
193: exec_bootdir = \
194: $(exec_prefix)/boot
195: exec_boot_PROGRAMS = \
196: gnumach
197:
198: #
199: # Building a distribution.
200: #
201:
202: EXTRA_DIST += \
203: config.status.dep.patch
204:
205: EXTRA_DIST += \
206: DEVELOPMENT
207:
208: dist-hook: dist-rm-CVS gen-ChangeLog
209:
210: .PHONY: dist-rm-CVS
211: dist-rm-CVS:
212: # Try to be very safe with respect to spuriously removing various directories
213: # in case of an error.
214: find $(distdir)/ -type d -name CVS | while read d; do \
215: rm -f "$$d"/{Entries,Repository,Root,Tag} && \
216: rmdir "$$d"; \
217: done
218:
219: gen_start_commit = e227045b06d62ee7d2fbab9d5ade9030ff43170b
220: ChangeLog_files = ChangeLog ChangeLog.0 ChangeLog.00
221: .PHONY: gen-ChangeLog
222: gen-ChangeLog:
223: $(AM_V_GEN)if test -d $(top_srcdir)/.git; then \
224: (cd $(top_srcdir)/ && \
225: ./gitlog-to-changelog --strip-tab \
226: $(gen_start_commit).. && \
227: echo) >> $(distdir)/cl-t && \
228: for f in $(ChangeLog_files); do \
229: (cd $(top_srcdir)/ && \
230: git show $(gen_start_commit):$$f) >> $(distdir)/cl-t && \
231: rm -f $(distdir)/$$f && \
232: mv $(distdir)/cl-t $(distdir)/$$f \
233: || exit $$?; \
234: done; \
235: fi
236:
237: DISTCLEANFILES += \
238: Makefile.orig \
239: config.status.orig
240:
241: #
242: # Legacy support.
243: #
244:
245: install-headers: install-data
246: @echo '*****************************************************'
247: @echo '* As you can see above, I was so kind to rewrite your'
248: @echo '* `make $@'\'
249: @echo '* into'
250: @echo '* `make $^'\'
251: @echo '* which is how it is to be spelled these days.'
252: @echo '*'
253: @echo '* Please get your instructions fixed.'
254: @echo '*****************************************************'
255: @echo
256: @echo 'Penalty:'
257: sleep 20
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.