-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
346 lines (302 loc) · 10.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# Makefile -- MiNTLib.
# Copyright (C) 1999-2001 Guido Flohr <guido@freemint.de>
#
# This file is part of the MiNTLib project, and may only be used
# modified and distributed under the terms of the MiNTLib project
# license, COPYMINT. By continuing to use, modify, or distribute
# this file you indicate that you have read the license and
# understand and accept it fully.
MAKEFLAGS = -r
SHELL = /bin/sh
srcdir = .
top_srcdir = .
include $(top_srcdir)/configvars
-include /etc/sparemint/timezone
ifdef TIMEZONE
LOCALTIME = $(TIMEZONE)
POSIXRULES = $(TIMEZONE)
endif
SUBDIRS = include syscall startup argp conf crypt dirent gmp login mintlib \
misc multibyte posix pwdgrp shadow signal socket stdiio stdio stdlib \
string sysvipc termios time unix
DIST_SUBDIRS = argp conf crypt dirent gmp include \
login mintlib misc multibyte posix pwdgrp shadow signal socket startup \
stdiio stdio stdlib string sunrpc syscall sysvipc termios time tz unix
TEST_SUBDIRS = argp crypt dirent login mintlib misc posix pwdgrp shadow signal \
socket startup stdiio stdio stdlib string time tz unix
BASE_FLAVOURS = m68000
ifeq ($(WITH_020_LIB), yes)
BASE_FLAVOURS += m68020
endif
ifeq ($(WITH_V4E_LIB), yes)
BASE_FLAVOURS += coldfire
endif
FLAVOURS = $(BASE_FLAVOURS)
ifeq ($(WITH_PROFILE_LIB), yes)
FLAVOURS += $(addsuffix -profile,$(BASE_FLAVOURS))
endif
ifeq ($(WITH_DEBUG_LIB), yes)
FLAVOURS += $(addsuffix -debug,$(BASE_FLAVOURS))
endif
ifeq ($(WITH_FASTCALL), yes)
FLAVOURS += $(addsuffix -fastcall,$(BASE_FLAVOURS))
endif
LIBDIRS += $(addprefix build/,$(FLAVOURS))
SUBDIRS += $(LIBDIRS)
# must come after lib dirs, since it needs the just-built library
SUBDIRS += tz sunrpc
include $(srcdir)/BINFILES
include $(srcdir)/SRCFILES
include $(srcdir)/MISCFILES
include $(srcdir)/EXTRAFILES
default: all
include phony
all: all-here all-recursive
# the SRCFILES, EXTRAFILES, and MISCFILES are still required by
# the rules; FIXME
all-here: $(top_srcdir)/includepath
@for flavour in $(FLAVOURS); do \
dir=build/$$flavour; \
mkdir -p $$dir/.deps; \
test -f $$dir/SRCFILES || touch $$dir/SRCFILES; \
test -f $$dir/EXTRAFILES || touch $$dir/EXTRAFILES; \
test -f $$dir/MISCFILES || touch $$dir/MISCFILES; \
cflags=""; \
nocflags=""; \
qualifier=""; \
cflags=""; \
for f in `echo $$flavour | sed -e 's/-/ /g'`; do \
case $$f in \
profile) \
qualifier=_p; \
nocflags="-fomit-frame-pointer"; \
cflags="$$cflags $(CFLAGS_profile)"; \
;; \
debug) \
qualifier=_g; \
nocflags="-O2 -O3 -fomit-frame-pointer -fexpensive-optimizations"; \
cflags="$$cflags $(CFLAGS_debug)"; \
;; \
m68000) \
cflags="$$cflags $(CFLAGS_m68000)"; \
;; \
m68020) \
cflags="$$cflags $(CFLAGS_m68020)"; \
;; \
coldfire) \
cflags="$$cflags $(CFLAGS_coldfire)"; \
;; \
short) \
cflags="$$cflags $(CFLAGS_short)"; \
;; \
fastcall) \
cflags="$$cflags $(CFLAGS_fastcall)"; \
;; \
esac; \
done; \
instdir=`$(CC) $$cflags -print-multi-directory`; \
test -f $$dir/BINFILES || echo "BINFILES = libc$${qualifier}.a libiio$${qualifier}.a" > $$dir/BINFILES; \
( echo "SHELL = /bin/sh"; \
echo "srcdir = ."; \
echo "top_srcdir = ../.."; \
echo "subdir = $$dir"; \
echo "qualifier = $$qualifier"; \
echo "cflags = $$cflags"; \
echo "nocflags = $$nocflags"; \
echo "instdir = $$instdir"; \
echo ""; \
echo "default: all"; \
echo ""; \
echo 'include $$(top_srcdir)/buildrules'; \
) > $$dir/Makefile; \
done
install: all-here install-recursive zoneswarning
uninstall: uninstall-recursive
install-lib: all install-lib-recursive
install-include: all install-include-recursive
install-headers: install-headers-recursive
install-man: all install-man-recursive
clean:: clean-recursive
rm -rf .deps includepath CFILES build
distclean:: distclean-recursive
bakclean: bakclean-recursive
checkclean: checkclean-recursive
DISTFILES = $(MISCFILES) $(SRCFILES)
BINDISTFILES = $(MISCFILES) $(BINFILES)
distdir = mintlib-$(VERSION)
bindistdir = $(distdir)-bin
topdistdir = $(distdir)
topbindistdir = $(topdistdir)-bin
$(top_srcdir)/includepath: $(top_srcdir)/configvars
@echo "Generating $@"; \
installdir=`$(CC) --print-search-dirs | awk '{ print $$2; exit; }'`; \
echo "$${installdir}include -I$${installdir}include-fixed" >$@
@if [ -z "$$(<$@)" ]; then \
rm $@; \
echo "error: The syntax \$$(<file) is unsupported by $(SHELL)." >&2; \
echo " Please use \"$(MAKE) SHELL=/bin/bash\" instead." >&2; \
exit 1; \
fi
dist-check:
@echo "WARNING: This will take VERY long and will consume"
@echo "VERY much diskspace!!!"
@$(MAKE) dist && tar xzf $(distdir).tar.gz && cd $(distdir) \
&& $(MAKE) && $(MAKE) bin-dist \
&& echo "##################################################" \
&& echo "# $(distdir) is ready for distribution." \
&& echo "##################################################"
@rm -rf $(distdir)
dist: $(top_srcdir)/CFILES $(top_srcdir)/include/features.h \
$(top_srcdir)/include/linker.h distdir
-chmod -R a+r $(distdir)
touch $(distdir)/include/features.h $(distdir)/include/linker.h
GZIP=$(GZIP) $(TAR) chzf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
@if sed 15q $(srcdir)/ChangeLog | fgrep -e "$(VERSION)" > /dev/null; then :; else \
echo "ChangeLog not updated; not releasing" 1>&2; \
exit 1; \
fi
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p -r $$d/$$file $(distdir)/$$file; \
done
for subdir in $(DIST_SUBDIRS); do \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|| exit 1; \
done
bin-dist: bindistdir
-chmod -R a+r $(bindistdir)
GZIP=$(GZIP) $(TAR) chzf $(bindistdir).tar.gz $(bindistdir)
-rm -rf $(bindistdir)
bindistdir: $(BINDISTFILES)
@if sed 15q $(srcdir)/ChangeLog | fgrep -e "$(VERSION)" > /dev/null; then :; else \
echo "ChangeLog not updated; not releasing" 1>&2; \
exit 1; \
fi
-rm -rf $(bindistdir)
mkdir $(bindistdir)
-chmod 777 $(bindistdir)
@for file in $(BINDISTFILES); do \
d=$(srcdir); \
test -f $(bindistdir)/$$file \
|| ln $$d/$$file $(bindistdir)/$$file 2> /dev/null \
|| cp -p -r $$d/$$file $(bindistdir)/$$file; \
done
for subdir in $(DIST_SUBDIRS); do \
test "$$subdir" = "src" && continue; \
(cd $$subdir && $(MAKE) top_distdir=../$(bindistdir) binbasedir=../$(bindistdir) bindistdir) \
|| exit 1; \
done
all-recursive clean-recursive distclean-recursive bakclean-recursive \
install-recursive uninstall-recursive \
install-include-recursive install-man-recursive \
uninstall-include-recursive uninstall-man-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
echo $@ | grep -q install; \
if test $$? = 0 -a "${CROSS}" = yes -a "$(DESTDIR)${prefix}" = "/usr"; then \
echo "attempting to install on host; aborting" >&2; \
exit 1; \
fi; \
list='$(SUBDIRS)'; \
if test "$@" = clean-recursive; then list='$(filter-out $(LIBDIRS),$(SUBDIRS))'; fi; \
if test "$@" = distclean-recursive; then list='$(filter-out $(LIBDIRS),$(SUBDIRS))'; fi; \
for subdir in $$list; do \
target=`echo $@ | sed s/-recursive//`; \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $$target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
install-lib-recursive uninstall-lib-recursive:
echo $@ | grep -q install; \
if test $$? = 0 -a "${CROSS}" = yes -a "$(DESTDIR)${prefix}" = "/usr"; then \
echo "attempting to install on host; aborting" >&2; \
exit 1; \
fi; \
list='$(LIBDIRS)'; \
for subdir in $$list; do \
target=`echo $@ | sed s/-recursive//`; \
echo "Making $$target in $$subdir"; \
$(MAKE) -C $$target $$subdir || exit 1; \
done
install-headers-recursive:
if test "${CROSS}" = yes -a "$(DESTDIR)${prefix}" = "/usr"; then \
echo "attempting to install on host; aborting" >&2; \
exit 1; \
fi; \
$(MAKE) -C syscall all || exit 1; \
list='include sunrpc'; \
for subdir in $$list; do \
target=`echo $@ | sed s/-recursive//`; \
echo "Making $$target in $$subdir"; \
$(MAKE) -C $$subdir $$target || exit 1; \
done
dist-recursive bindist-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
target=`echo $@ | sed s/-recursive//`; \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $$target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
check-recursive checkclean-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
list='$(TEST_SUBDIRS)'; for subdir in $$list; do \
target=`echo $@ | sed s/-recursive//`; \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $$target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
help:
@echo "This Makefile (and most of the Makefiles in the subdirectories)"
@echo "supports the following main targets:"
@echo
@echo " help show this help page (toplevel Makefile only)"
@echo " all build everyting (default)"
@echo " install install everything"
@echo " uninstall uninstall all files"
@echo " zonenames list possible values for time zone"
@echo " check build and run tests"
@echo
@echo "The following targets are intended for use by the"
@echo "maintainer:"
@echo
@echo " dist make a source distribution (toplevel Makefile"
@echo " only)"
@echo " bin-dist make a binary distribution (toplevel Makefile"
@echo " only)"
@echo
@echo "Please read the file INSTALL before running make. Edit"
@echo "the file configvars so that it matches the needs of "
@echo "your site."
zonenames:
cd $(top_srcdir)/tz && $(MAKE) zonenames
zoneswarning:
@if test $(LOCALTIME) = Factory; then \
echo "WARNING: Installed tz database with localtime set to" ;\
echo "dummy time zone \`Factory'. Run \`zic -l' with the" ;\
echo "correct timezone later or re-install after editing" ;\
echo "the \`LOCALTIME' variable in \`$(top_srcdir)/configvars." ;\
fi
@if test $(POSIXRULES) = America/New_York; then \
echo "WARNING: Installed tz database with posixrules set to" ;\
echo "dummy time zone \`Factory'. Run \`zic -p' with the" ;\
echo "correct timezone later or re-install after editing" ;\
echo "the \`POSIXRULES' variable in \`$(top_srcdir)/configvars." ;\
fi
check: check-recursive
00PatchLevel: 00PatchLevel.in configvars
rm -f $@
sed 's,@VERSION@,$(VERSION),g' $@.in >$@
mintlib.spec: mintlib.spec.in configvars
rm -f $@
sed 's,@VERSION@,$(VERSION),g' $@.in >$@