blob: 3cf85c7c77a8a214bec6413744cda7db9ef30cc0 (
plain)
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
|
#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) \
LIBPRE='$(LIBPRE)' 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.
#ifdef __linux__
AR=ar86
#endif
#ifdef __GNUC__
# unproto is yukky, I've included '-w' in the local makefile.
WALL =-Wtraditional -Wshadow -Wid-clash-14 -Wpointer-arith \
-Wcast-qual -Wcast-align -Wconversion -Waggregate-return \
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls \
-Wnested-externs -Winline
WALL =-Wstrict-prototypes
CC =gcc
CFLAGS =$(GCCFLAG) -Wall $(WALL) -O2 -g
#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 =-3
LDFLAGS =-3 -s -N
#else
CFLAGS =-0
LDFLAGS =-0 -s -H10000
BCCARCH =-Mf -O
#endif
#endif
# Alter these if for some reason you don't want this done as root.
#ifdef __BCC__
INDAT=-o root -g root -m 644
INEXE=-o root -g root -m 755
INSCR=-o root -g root -m 755
#else
INDAT=-o root -g root -m 644
INEXE=-o root -g root -m 755 -s
INSCR=-o root -g root -m 755
#endif
#ifdef GNUMAKE
all: check_config bcc unproto copt as86 ar86 ld86 objdump86 \
library lib-bsd alt-libs elksemu
#else
all: check_config bcc 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.'
#endif
install: check_config install-bcc install-man \
install-lib install-lib2 install-emu
install-all: install install-other
##############################################################################
LIBARGS= CC=ncc CCFLAGS= AR=$(AR) ARFLAGS=$(ARFLAGS)
# Season in the top makefile
ELKSSRC= %ELKSSRC%
PREFIX= %PREFIX%
LIBPRE= %LIBPRE%
BINDIR= %BINDIR%
LIBDIR= %LIBDIR%
#ifdef GNUMAKE
export ELKSSRC
#endif
DISTBIN= $(DIST)$(BINDIR)
DISTLIB= $(DIST)$(LIBDIR)
DISTPRE= $(DIST)$(LIBPRE)
# Others to install
OTHERS= tests dis88 doselks bootblocks
CLEANLIST= bcc as ar ld 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
bcc: bindir
$(MAKEC) bcc $(MAKEARG) BCCARCH='$(BCCARCH)' bcc ncc bcc-cc1
cp -p bcc/bcc bin/Bcc
cp -p bcc/ncc bin/ncc
cp -p bcc/bcc-cc1 lib/bcc-cc1
unproto: bindir
$(MAKEC) unproto $(MAKEARG) unproto
cp -p unproto/unproto lib/unproto
copt: bindir
$(MAKEC) copt $(MAKEARG) copt
cp -p copt/copt lib/copt
cp -p copt/rules.* lib/.
as86: bindir
$(MAKEC) as $(MAKEARG) all
cp -p as/as86 bin/as86
cp -p as/as86_encap bin/as86_encap
ar86: bindir
$(MAKEC) ar $(MAKEARG) all
cp -p ar/ar86 bin/ar86
ld86: bindir
$(MAKEC) ld $(MAKEARG) ld86
cp -p ld/ld86 bin/ld86
ld86r: bindir
$(MAKEC) ld $(MAKEARG) ld86r
cp -p ld/ld86r bin/ld86r
objdump86: bindir
$(MAKEC) ld $(MAKEARG) objdump86
cp -p ld/objdump86 bin/objdump86
elksemu: bindir
#ifndef __AS386_16__
#ifdef __linux_i386__
$(MAKEC) elksemu \
CC='$(CC)' PREFIX=$(PREFIX) LIBPRE='$(LIBPRE)' LIBDIR='$(LIBDIR)' BINDIR='$(BINDIR)' \
elksemu
#else
$(MAKEC) elksemu CC='ncc' elksemu
#endif
cp -p elksemu/elksemu bin/elksemu
#endif
install-ln: bcc unproto copt as86 ar86 ld86 elksemu
install -d $(DISTBIN)
ln -fs `pwd`/bin/ncc $(DISTBIN)/bcc
ln -fs `pwd`/bin/as86_encap $(DISTBIN)/as86_encap
ln -fs `pwd`/bin/as86 $(DISTBIN)/as86
ln -fs `pwd`/bin/ar86 $(DISTBIN)/ar86
ln -fs `pwd`/bin/ld86 $(DISTBIN)/ld86
#ifndef __AS386_16__
ln -fs `pwd`/bin/elksemu $(DIST)/lib/elksemu
#endif
-install -d $(DIST)/usr/lib
-install $(INDAT) libc/error/liberror.txt $(DIST)/usr/lib/liberror.txt
install-bcc: bcc unproto copt as86 ar86 ld86 objdump86
install -d $(DISTBIN) $(DISTLIB) $(DISTLIB)/i86
install $(INEXE) bin/Bcc $(DISTBIN)/bcc
install $(INSCR) bin/as86_encap $(DISTBIN)/as86_encap
install $(INEXE) bin/as86 $(DISTBIN)/as86
install $(INEXE) bin/ar86 $(DISTBIN)/ar86
install $(INEXE) bin/ld86 $(DISTBIN)/ld86
install $(INEXE) bin/objdump86 $(DISTBIN)/objdump86
install $(INEXE) bin/objdump86 $(DISTBIN)/nm86
install $(INEXE) bin/objdump86 $(DISTBIN)/size86
install $(INEXE) lib/bcc-cc1 $(DISTLIB)/bcc-cc1
install $(INEXE) lib/unproto $(DISTLIB)/unproto
install $(INEXE) lib/copt $(DISTLIB)/copt
install $(INDAT) lib/rules.* $(DISTLIB)/i86
@test ! -f $(DISTLIB)/as86 || rm -f $(DISTLIB)/as86
@test ! -f $(DISTLIB)/ld86 || rm -f $(DISTLIB)/ld86
# NB: This doesn't install as a suid root, that's ok though.
install-emu: elksemu
#ifndef __AS386_16__
install -d $(DIST)/lib
install $(INEXE) bin/elksemu $(DIST)/lib/elksemu
#endif
install-man:
-$(MAKEC) man MANDIR=$(DIST)$(PREFIX)/man install
install-lib: lib/lib0-done lib/lib2-done
install -d $(DISTLIB)/i86
$(MAKEC) libc $(LIBARGS) BCCHOME=$(DISTPRE) install_incl
install $(INDAT) lib/crt0.o $(DISTLIB)/i86/crt0.o
install $(INDAT) lib/libc.a $(DISTLIB)/i86/libc.a
install $(INDAT) lib/libbsd.a $(DISTLIB)/i86/libbsd.a
-install -d $(DIST)/usr/lib
-install $(INDAT) libc/error/liberror.txt $(DIST)/usr/lib/liberror.txt
install-lib2: lib/lib1-done
install -d $(DISTLIB)/i86
install $(INDAT) lib/libc_f.a $(DISTLIB)/i86/libc_f.a
install $(INDAT) lib/libc_s.a $(DISTLIB)/i86/libc_s.a
install $(INDAT) lib/libdos.a $(DISTLIB)/i86/libdos.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 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
#else
alt-libs: lib-stand lib-dos lib-386 lib-fast
#endif
@touch lib/lib1-done
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
#ifndef __AS386_16__
lib-386: bindir
test -f bin/ncc
$(MAKEC) libc $(LIBARGS) 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
#endif
##############################################################################
#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
##############################################################################
install-other:
@for i in $(OTHERS) ; do \
$(MAKEC) $$i BCC=ncc DIST=$(DIST) PREFIX=$(PREFIX) install || exit 1 ; \
done
other:
@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`
##############################################################################
|