-
Notifications
You must be signed in to change notification settings - Fork 44
/
makefile.in
374 lines (306 loc) · 9.72 KB
/
makefile.in
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
#ifdef COMMENT
##############################################################################
#
# This Makefile has been completely re-vamped. Two reasons, first to allow
# for a full compile before installation, hence allowing us to make a binary
# distribution without installing and second to allow proper dependancy trees
# for the different versions of the library.
#
# As an aside, it would be useful if I could avoid GNU-make constucts.
#
##############################################################################
#endif
# Defaults, generic C
ARFLAGS =r
CC =%CC%
CFLAGS =%CFLAGS%
LDFLAGS =
MAKEARG =CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \
PREFIX=$(PREFIX) LIBDIR='$(LIBDIR)' \
BINDIR='$(BINDIR)' ANSI='$(ANSI)'
MAKEC=$(MAKE) -C
MAKEX=
# This is only allowed on Linux because make needs to know how to look
# inside an archive to get the last modified times of the component .o
# files. This should be fine for Linux, but it won't be for AIX etc.
# Unfortunatly it's even _required_ for linux because some versions
# have a broken standard ar command. Ie they barf if given something
# they think is not an a.out.
#ifdef __linux__
AR=ar86
#endif
#ifdef __GNUC__
CC =%CC%
#ifdef GCCDB
WALL =-Wall -Wtraditional -Wshadow -Wpointer-arith \
-Wcast-qual -Wcast-align -Wconversion -Waggregate-return \
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls \
-Wnested-externs -Winline
CFLAGS =$(GCCFLAG) $(WALL) -O2 -g
#else
WALL =-Wall -Wstrict-prototypes
CFLAGS =$(GCCFLAG) -O2 -fno-strict-aliasing
#endif
#endif
#ifndef GNUMAKE
MAKEC=sh makec
MAKEX=makec
#endif
#ifdef __minix
# Minix make doesn't understand -C, cc runs out of memory with the headers.
MAKEC=ash makec
MAKEX=makec
CFLAGS=-O -m -w -DPOSIX_HEADERS_MISSING -DVERY_SMALL_MEMORY
#endif
#ifdef __BCC__
ANSI =-ansi
#ifdef __AS386_32__
CFLAGS =-Ml
LDFLAGS =-Ml -s
#else
CFLAGS =-O
LDFLAGS =-s -H10000
BCCARCH =
#endif
#endif
# Apple cpp-precomp 6.14 (devkit-213/devkit_tools-214) cannot
# handle the QUOT macro in bcc. It puts a space in /usr so that
# it becomes / usr
#ifdef __APPLE__
CFLAGS += -no-cpp-precomp
#endif
# Install files with the userid of the currently running process.
INDAT=-m 644
INEXE=-m 755 -s
INSCR=-m 755
#ifdef __CYGWIN__
EXE=.exe
#else
EXE=
#endif
#ifdef GNUMAKE
all: check_config bcc86 cpp unproto copt as86 ar86 ld86 objdump86 \
library lib-bsd alt-libs elksemu
install: check_config install-bcc install-man \
install-lib install-emu
install-all: install install-other
#else
all: check_config bcc86 cpp unproto copt as86 ar86 ld86 objdump86
@echo
@echo 'NOTE: To build the libraries you need GNU-Make.'
@echo ' They are available precompiled in the Dev86clb-X.X.X.zip file.'
install install-all: check_config install-bcc install-man
@echo
@echo 'NOTE: To build the libraries you need GNU-Make.'
@echo ' They are available precompiled in the Dev86clb-X.X.X.zip file.'
#endif
##############################################################################
LIBARGS= CC=ncc "CCFLAGS=-O" AR=$(AR) ARFLAGS=$(ARFLAGS)
LIB3ARGS= CC=ncc AR=$(AR) ARFLAGS=$(ARFLAGS)
# Season in the top makefile
ELKSSRC= %ELKSSRC%
PREFIX= %PREFIX%
BINDIR= %BINDIR%
LIBDIR= %LIBDIR%
INCLDIR= %INCLDIR%
ASLDDIR= %ASLDDIR%
MANDIR= %MANDIR%
#ifdef GNUMAKE
export ELKSSRC
#endif
DISTBIN= $(DIST)$(BINDIR)
DISTLIB= $(DIST)$(LIBDIR)
DISTASLD=$(DIST)$(ASLDDIR)
DISTINCL=$(DIST)$(INCLDIR)
# Others to install
OTHERS= tests dis88 doselks bootblocks
CLEANLIST= bcc as ar ld cpp unproto copt libc elksemu libbsd $(OTHERS)
##############################################################################
bindir: $(MAKEX)
@mkdir -p bin lib lib/i386
@rm -f include
@ln -s libc/include include 2>/dev/null || true
#ifndef GNUMAKE
@rm -f include/linuxmt include/arch || true
@ln -s ../kinclude/linuxmt include/linuxmt 2>/dev/null || true
@ln -s ../kinclude/arch include/arch 2>/dev/null || true
#endif
bcc86: bindir versions
$(MAKEC) bcc $(MAKEARG) BCCARCH='$(BCCARCH)' bcc ncc bcc-cc1
cp -p bcc/bcc$(EXE) bin/Bcc$(EXE)
cp -p bcc/ncc$(EXE) bin/ncc$(EXE)
cp -p bcc/bcc-cc1$(EXE) lib/bcc-cc1$(EXE)
cpp: bindir
$(MAKEC) cpp $(MAKEARG) bcc-cpp
cp -p cpp/bcc-cpp$(EXE) lib/bcc-cpp$(EXE)
unproto: bindir
$(MAKEC) unproto $(MAKEARG) unproto
cp -p unproto/unproto$(EXE) lib/unproto$(EXE)
copt: bindir
$(MAKEC) copt $(MAKEARG) copt
cp -p copt/copt$(EXE) lib/copt$(EXE)
cp -p copt/rules.* lib/.
cp -p copt/rules.start lib/i386/.
cp -p copt/rules.386 lib/i386/.
cp -p copt/rules.end lib/i386/.
as86: bindir versions
$(MAKEC) as $(MAKEARG) all
cp -p as/as86$(EXE) bin/as86$(EXE)
cp -p as/as86_encap bin/as86_encap
ar86: bindir
$(MAKEC) ar $(MAKEARG) all
cp -p ar/ar86$(EXE) bin/ar86$(EXE)
ld86: bindir versions
$(MAKEC) ld $(MAKEARG) ld86
cp -p ld/ld86$(EXE) bin/ld86$(EXE)
ld86r: bindir
$(MAKEC) ld $(MAKEARG) ld86r
cp -p ld/ld86r$(EXE) bin/ld86r$(EXE)
objdump86: bindir
$(MAKEC) ld $(MAKEARG) objdump86
cp -p ld/objdump86$(EXE) bin/objdump86$(EXE)
#ifndef __AS386_16__
#ifdef __elksemu_works__
elksemu: bindir
$(MAKEC) elksemu elksemu
cp -p elksemu/elksemu bin/elksemu
#else
try_elksemu: bindir
$(MAKEC) elksemu CC='ncc' elksemu
cp -p elksemu/elksemu bin/elksemu
#endif
#endif
install-bcc: bcc86 cpp unproto copt as86 ar86 ld86 objdump86
install -d $(DISTBIN) $(DISTLIB)
install $(INEXE) bin/Bcc$(EXE) $(DISTBIN)/bcc$(EXE)
install $(INEXE) bin/as86$(EXE) $(DISTASLD)/as86$(EXE)
install $(INEXE) bin/ld86$(EXE) $(DISTASLD)/ld86$(EXE)
install $(INEXE) bin/ar86$(EXE) $(DISTBIN)/ar86$(EXE)
install $(INEXE) bin/objdump86$(EXE) $(DISTBIN)/objdump86$(EXE)
install $(INEXE) bin/objdump86$(EXE) $(DISTBIN)/nm86$(EXE)
install $(INEXE) bin/objdump86$(EXE) $(DISTBIN)/size86$(EXE)
install $(INSCR) bin/as86_encap $(DISTLIB)/as86_encap
install $(INEXE) lib/bcc-cc1$(EXE) $(DISTLIB)/bcc-cc1$(EXE)
install $(INEXE) lib/bcc-cpp$(EXE) $(DISTLIB)/bcc-cpp$(EXE)
install $(INEXE) lib/unproto$(EXE) $(DISTLIB)/unproto$(EXE)
install $(INEXE) lib/copt$(EXE) $(DISTLIB)/copt$(EXE)
install $(INDAT) lib/rules.* $(DISTLIB)
install -d $(DISTLIB)/i386
install $(INDAT) lib/i386/rules.* $(DISTLIB)/i386
# NB: This doesn't install as a suid root, that's ok though.
install-emu: elksemu
#ifdef __elksemu_works__
install -d $(DISTBIN)
install $(INEXE) bin/elksemu $(DISTBIN)/elksemu
#endif
install-man:
-$(MAKEC) man MANDIR=$(DIST)$(MANDIR) install
install-lib: lib/lib0-done lib/lib2-done lib/lib1-done
$(MAKEC) libc $(LIBARGS) DISTINCL=$(DISTINCL) install_incl
install $(INDAT) lib/crt0.o $(DISTLIB)/crt0.o
install $(INDAT) lib/libc.a $(DISTLIB)/libc.a
install $(INDAT) lib/libc_f.a $(DISTLIB)/libc_f.a
install $(INDAT) lib/libc_s.a $(DISTLIB)/libc_s.a
install $(INDAT) lib/libbsd.a $(DISTLIB)/libbsd.a
install $(INDAT) lib/libdos.a $(DISTLIB)/libdos.a
install $(INDAT) lib/libbcc.a $(DISTLIB)/libbcc.a
#ifndef __AS386_16__
install -d $(DISTLIB)/i386
install $(INDAT) lib/i386/crt0.o $(DISTLIB)/i386/crt0.o
install $(INDAT) lib/i386/libc.a $(DISTLIB)/i386/libc.a
#endif
lib/lib0-done:
$(MAKE) -f make.fil library
lib/lib1-done:
$(MAKE) -f make.fil alt-libs
lib/lib2-done:
$(MAKE) -f make.fil lib-bsd
all-libs: library lib-bsd alt-libs
@:
library: bindir
test -f bin/ncc
$(MAKEC) libc $(LIBARGS) PLATFORM=i86-ELKS
cp -p libc/crt0.o libc/libc.a libc/libbcc.a lib/.
sh libcompat lib/libc.a
@touch lib/lib0-done
lib-bsd: bindir
test -f bin/ncc
$(MAKEC) libbsd $(LIBARGS)
cp -p libbsd/libbsd.a lib/libbsd.a
sh libcompat lib/libbsd.a
@touch lib/lib2-done
#ifdef __AS386_16__
alt-libs: lib-stand lib-dos lib-fast
@touch lib/lib1-done
#else
alt-libs: lib-stand lib-dos lib-386 lib-fast
@touch lib/lib1-done
#endif
lib-fast: bindir
test -f bin/ncc
$(MAKEC) libc $(LIBARGS) PLATFORM=i86-FAST
cp -p libc/libc_f.a lib/libc_f.a
sh libcompat lib/libc_f.a
lib-stand: bindir
test -f bin/ncc
$(MAKEC) libc $(LIBARGS) PLATFORM=i86-BIOS
cp -p libc/libc_s.a lib/libc_s.a
sh libcompat lib/libc_s.a
lib-dos: bindir
test -f bin/ncc
$(MAKEC) libc $(LIBARGS) PLATFORM=i86-DOS
cp -p libc/libdos.a lib/libdos.a
sh libcompat lib/libdos.a
lib-386: bindir
test -f bin/ncc
$(MAKEC) libc $(LIB3ARGS) PLATFORM=i386-BCC
cp -p libc/crt3.o lib/i386/crt0.o
cp -p libc/libc3.a lib/i386/libc.a
sh libcompat lib/i386/libc.a
##############################################################################
#ifdef GNUMAKE
check_config: $(MAKEX)
$(MAKEC) libc .config.dir
config: $(MAKEX)
$(MAKEC) libc config
#else
check_config: ;
config: ;
#endif
makec:
echo 'cd $$1 ; shift ; make "$$@"' > makec
chmod +x makec
versions: bcc/version.h
bcc/version.h: Makefile
echo '#define VERSION "'"$(VERSION)"'"' > bcc/version.h
echo '#define VERSION "'"$(VERSION)"'"' > as/version.h
echo '#define VERSION "'"$(VERSION)"'"' > bootblocks/version.h
echo '#define VERSION "'"$(VERSION)"'"' > ld/version.h
VER=$(VERSION) ; \
echo "#define VER_MAJ $${VER%%.*}" >> bcc/version.h ; \
VER="$${VER#*.}" ; \
echo "#define VER_MIN $${VER%.*}" >> bcc/version.h ; \
echo "#define VER_PAT $${VER#*.}" >> bcc/version.h
##############################################################################
install-other: other
@for i in $(OTHERS) ; do \
$(MAKEC) $$i BCC=ncc DIST=$(DIST) PREFIX=$(PREFIX) install || exit 1 ; \
done
other: versions
@for i in $(OTHERS) ; do \
$(MAKEC) $$i BCC=ncc DIST=$(DIST) PREFIX=$(PREFIX) || exit 1; \
done
##############################################################################
clean:
-@for i in $(CLEANLIST) ; do $(MAKEC) $$i $@ ; true ; done
realclean:
-@for i in $(CLEANLIST) ; do $(MAKEC) $$i $@ ; true ; done
rm -rf bin lib
rm -f include
rm -f makec
rm -f `find $(CLEANLIST) -type l -print`
rm -f bcc/version.h
rm -f as/version.h
rm -f ld/version.h
rm -f bootblocks/version.h
##############################################################################