1
1
#
2
- # $Id: Makefile,v 2.1 2021-03-26 11:28:07 clib2devs Exp $
2
+ # $Id: Makefile,v 2.1 2021-03-26 11:28:07 clib4devs Exp $
3
3
#
4
4
# :ts=8
5
5
#
23
23
# called "netinclude".
24
24
UNAME := $(shell uname)
25
25
26
- INSTALL_PREFIX ?= /usr/ppc-amigaos/SDK/clib2
26
+ INSTALL_PREFIX ?= /usr/ppc-amigaos/SDK/clib4
27
27
SDK_INCLUDE ?= /usr/ppc-amigaos/SDK/include
28
28
29
29
CC := ppc-amigaos-gcc
30
30
AR := ppc-amigaos-ar -q
31
31
LD := ppc-amigaos-ld
32
32
RANLIB := ppc-amigaos-ranlib
33
+ STRIP := ppc-amigaos-strip
34
+ RANLIB := ppc-amigaos-ranlib
35
+ HOST_CXX := g++
33
36
34
37
# On AmigaOS use native commands
35
38
ifeq ($(UNAME), AmigaOS)
@@ -51,16 +54,16 @@ LIB_ROOT ?= $(shell pwd)
51
54
LIB_DIR = $(LIB_ROOT)/library
52
55
BUILD_DIR = $(LIB_ROOT)/build
53
56
OUTPUT_LIB = $(BUILD_DIR)/lib
54
- DPKG_LIB = clib2_1 .0_amd64
57
+ DPKG_LIB = clib4_1 .0_amd64
55
58
56
59
##############################################################################
57
60
58
61
WARNINGS := \
59
62
-Wall -W -Wextra -Wpointer-arith -Wsign-compare -Wmissing-prototypes \
60
- -Wundef -Wmissing-declarations -Wunused -Wwrite-strings -Wno-unused-value -Wno-comment \
61
- -Wno-deprecated-declarations -Wno-sign-compare -Wno-cast-function-type -Wno- unused-variable -Wno-parentheses -Wno-missing-prototypes \
63
+ -Wundef -Wmissing-declarations -Wunused -Wwrite-strings -Wno-unused-value -Wno-comment -Wno-missing-braces \
64
+ -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused-variable -Wno-parentheses -Wno-missing-prototypes \
62
65
-Wstrict-aliasing -Wno-shadow -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing \
63
- -Wno-type-limits # -Werror -Wbad-function-cast -Wconversion -Wformat
66
+ -Wno-type-limits -Wno-cast-function-type -Werror # -Wbad-function-cast -Wconversion -Wformat
64
67
65
68
PIC := -fPIC -DPIC
66
69
INCLUDES := -I$(LIB_DIR)/include \
@@ -78,10 +81,12 @@ INCLUDES := -I$(LIB_DIR)/include \
78
81
-I$(LIB_DIR)/math \
79
82
-I$(LIB_DIR)/misc \
80
83
-I$(LIB_DIR)/mount \
84
+ -I$(LIB_DIR)/ndbm \
81
85
-I$(LIB_DIR)/posix \
82
86
-I$(LIB_DIR)/profile \
83
87
-I$(LIB_DIR)/usergroup \
84
88
-I$(LIB_DIR)/search \
89
+ -I$(LIB_DIR)/shared_library \
85
90
-I$(LIB_DIR)/socket \
86
91
-I$(LIB_DIR)/stat \
87
92
-I$(LIB_DIR)/stdio \
@@ -96,8 +101,8 @@ SHARED := $(if $(SHARED),$(SHARED),yes)
96
101
STATIC := $(if $(STATIC),$(STATIC),yes)
97
102
98
103
LARGEDATA :=
99
- OPTIONS += $(LARGEDATA) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__CLIB2__ -Wa,-mregnames -fno-builtin -nostdlib -D_GNU_SOURCE -D_XOPEN_SOURCE -D_USE_GNU
100
- OPTIMIZE := -O3 -mregnames -mmultiple -mupdate -mstrict-align
104
+ OPTIONS += $(LARGEDATA) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__CLIB2__ -Wa,-mregnames -fno-builtin -nostdlib -D_GNU_SOURCE -D_XOPEN_SOURCE -D_USE_GNU -pipe
105
+ OPTIMIZE := -O3 -mregnames -mmultiple -mupdate -ffp-contract=fast - mstrict-align
101
106
102
107
STABS :=
103
108
DLIBS :=
@@ -111,10 +116,15 @@ endif
111
116
112
117
CFLAGS := $(WARNINGS) $(OPTIMIZE) $(OPTIONS) $(INCLUDES) -D__USE_INLINE__
113
118
CFLAGS_N := $(WARNINGS) $(OPTIMIZE) $(OPTIONS) $(INCLUDES)
114
- AFLAGS := -Wa,-mregnames
119
+ AFLAGS := -Wa,-mregnames -mstrict-align
115
120
116
121
ifdef SPE
117
- CFLAGS := $(CFLAGS) -DSPE
122
+ CC := ppc-amigaos-gcc-6.4.0
123
+ AS := ppc-amigaos-as-6.4.0
124
+ CMATH := -mfpu=dp_lite
125
+ CFLAGS := $(CFLAGS) -D__SPE__ -mspe -mtune=8540 -mcpu=8540 -mabi=spe -mfloat-gprs=double $(CMATH) -fno-inline-functions -fno-partial-inlining \
126
+ -fno-align-functions -fno-align-jumps -fno-align-loops -fno-align-labels -fno-inline-small-functions -fno-indirect-inlining -Wno-overflow -Wno-unused-but-set-variable -Wno-uninitialized #-Wdouble-promotion
127
+ AFLAGS := $(AFLAGS) -mvrsave -D__SPE__ -mspe -mtune=8540 -mcpu=8540 -mfloat-gprs=double $(CMATH) -Wno-overflow
118
128
endif
119
129
120
130
VERBOSE ?= @
@@ -123,7 +133,7 @@ VERBOSE ?= @
123
133
124
134
# This is the first target: it depends on all the targets
125
135
126
- all: prepare all-targets all-libs clib2 .library.debug clib2 .library
136
+ all: prepare all-targets all-libs clib4 .library.debug clib4 .library
127
137
128
138
##############################################################################
129
139
@@ -150,16 +160,21 @@ prepare:
150
160
-$(MAKEDIR) $(INSTALL_PREFIX)/lib
151
161
-$(MAKEDIR) $(INSTALL_PREFIX)/include
152
162
153
- all-targets: \
163
+ ALL_TARGETS = \
154
164
$(OUTPUT_LIB)/crt0.o \
155
165
$(OUTPUT_LIB)/crtbegin.o \
156
166
$(OUTPUT_LIB)/crtend.o \
157
167
$(OUTPUT_LIB)/shcrtbegin.o \
158
168
$(OUTPUT_LIB)/shcrtend.o \
159
- $(OUT_SHARED_LIB)/shared_library/clib2 .o \
169
+ $(OUT_SHARED_LIB)/shared_library/clib4 .o \
160
170
$(OUT_SHARED_LIB)/shared_library/math.o \
161
171
$(MAIN_LIB)
162
- #$(info $(OBJ_C_SRC))
172
+
173
+ ifdef SPE
174
+ ALL_TARGETS := PatchForSPE | $(ALL_TARGETS)
175
+ endif
176
+
177
+ all-targets: $(ALL_TARGETS)
163
178
164
179
all-libs: $(LIBS)
165
180
@@ -170,11 +185,12 @@ clean:
170
185
-$(DELETE) $(BUILD_DIR)/obj
171
186
-$(DELETE) $(BUILD_DIR)/obj.shared
172
187
-$(DELETE) $(BUILD_DIR)/shared
188
+ -$(DELETE) $(BUILD_DIR)/PatchForSPE
173
189
-$(DELETE) $(OUTPUT_LIB)
174
190
-$(DELETE) $(BUILD_DIR)/compiler.log
175
- -$(DELETE) $(BUILD_DIR)/clib2 .library*
176
- -$(DELETE) clib2 .lha
177
- -$(DELETE) clib2 .bak
191
+ -$(DELETE) $(BUILD_DIR)/clib4 .library*
192
+ -$(DELETE) clib4 .lha
193
+ -$(DELETE) clib4 .bak
178
194
-$(DELETE) $(DPKG_LIB)
179
195
-$(DELETE) $(DPKG_LIB).deb
180
196
-cd test_programs; make clean
@@ -195,14 +211,14 @@ version:
195
211
bumprev crypt.lib
196
212
bumprev pthread.lib
197
213
198
- # Shared clib2 .library rules
214
+ # Shared clib4 .library rules
199
215
200
- clib2 .library.debug: $(OBJ_C_LIB)
201
- $(VERBOSE)$(CC) -o $(BUILD_DIR)/$@ $(CFLAGS) $(BUILD_DIR)/shared/shared_library/
clib2 .o $(BUILD_DIR)/shared/shared_library/math.o $(OBJ_C_LIB) $(DLIBS) -Wl,--cref,-M,-Map=$(BUILD_DIR)/
[email protected] -nostartfiles -nostdlib
216
+ clib4 .library.debug: $(OBJ_C_LIB)
217
+ $(VERBOSE)$(CC) -o $(BUILD_DIR)/$@ $(CFLAGS) $(BUILD_DIR)/shared/shared_library/
clib4 .o $(BUILD_DIR)/shared/shared_library/math.o $(OBJ_C_LIB) $(DLIBS) -Wl,--cref,-M,-Map=$(BUILD_DIR)/
[email protected] -nostartfiles -nostdlib
202
218
203
- clib2 .library: clib2 .library.debug
219
+ clib4 .library: clib4 .library.debug
204
220
cp $(BUILD_DIR)/$< $(BUILD_DIR)/$@
205
- ppc-amigaos-strip -R.comment -R.sdata2 --strip-unneeded-rel-relocs $(BUILD_DIR)/$@
221
+ $(STRIP) -R.comment -R.sdata2 --strip-unneeded-rel-relocs $(BUILD_DIR)/$@
206
222
207
223
##############################################################################
208
224
@@ -220,12 +236,12 @@ $(OUTPUT_LIB)/crt0.o : $(LIB_DIR)/crt0.S
220
236
$(VERBOSE)$(ASSEMBLE)
221
237
-$(COPY) $(OUTPUT_LIB)/crt0.o $(INSTALL_PREFIX)/lib/
222
238
223
- $(OUTPUT_LIB)/crtbegin.o : CFLAGS = -mcrt=clib2 $(STABS) $(OPTIONS) $(INCLUDES) -O0 -fno-aggressive-loop-optimizations
239
+ $(OUTPUT_LIB)/crtbegin.o : CFLAGS = -mcrt=clib4 $(STABS) $(OPTIONS) $(INCLUDES) -O0 -fno-aggressive-loop-optimizations
224
240
$(OUTPUT_LIB)/crtbegin.o : $(LIB_DIR)/crtbegin.c
225
241
$(VERBOSE)$(COMPILE)
226
242
-$(COPY) $(OUTPUT_LIB)/crtbegin.o $(INSTALL_PREFIX)/lib/
227
243
228
- $(OUTPUT_LIB)/crtend.o : CFLAGS = -mcrt=clib2 -O0 $(OPTIONS) $(INCLUDES) -fno-aggressive-loop-optimizations
244
+ $(OUTPUT_LIB)/crtend.o : CFLAGS = -mcrt=clib4 -O0 $(OPTIONS) $(INCLUDES) -fno-aggressive-loop-optimizations
229
245
$(OUTPUT_LIB)/crtend.o : $(LIB_DIR)/crtend.c
230
246
$(VERBOSE)$(COMPILE)
231
247
-$(COPY) $(OUTPUT_LIB)/crtend.o $(INSTALL_PREFIX)/lib/
@@ -250,14 +266,14 @@ endef
250
266
251
267
define COMPILE_INLINE
252
268
$(VERBOSE)@$(MAKEDIR) $(@D)
253
- $(VERBOSE)echo -e "\rCompiling Static \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
269
+ $(VERBOSE)echo -e "\rCompiling Inline Static \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
254
270
$(VERBOSE)$(CC) $(CFLAGS_N) -Wno-missing-prototypes -Wno-missing-declarations -D__timespec_defined -o $@ -c $< $(LOG_COMMAND)
255
271
endef
256
272
257
273
define COMPILE_ASM
258
274
$(VERBOSE)@$(MAKEDIR) $(@D)
259
275
$(VERBOSE)echo -e "\rCompiling Static ASM \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
260
- $(VERBOSE)$(CC) -o $@ -c $< $(LOG_COMMAND)
276
+ $(VERBOSE)$(CC) -o $@ -c $< $(LOG_COMMAND)
261
277
endef
262
278
263
279
define COMPILE_SHARED
@@ -290,16 +306,28 @@ $(VERBOSE)echo -e "\rAssembling altivec \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\
290
306
$(VERBOSE)$(CC) -maltivec -mabi=altivec -mvrsave -mregnames -DVRSAVE -o $@ -c $< $(LOG_COMMAND)
291
307
endef
292
308
309
+ define COMPILE_SPE_REG
310
+ $(VERBOSE)@$(MAKEDIR) $(@D)
311
+ $(VERBOSE)echo -e "\rAssembling SPE with regnames \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
312
+ $(VERBOSE)$(CC) $(AFLAGS) -mregnames -DVRSAVE -o $@ -c $< $(LOG_COMMAND)
313
+ endef
314
+
293
315
define COMPILE_SPE
294
316
$(VERBOSE)@$(MAKEDIR) $(@D)
295
- $(VERBOSE)echo -e "\rCompiling SPE \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
296
- $(VERBOSE)$(CC) -mspe -mcpu=8540 -mfloat-gprs=double -mabi=spe -o $@ -c $< $(LOG_COMMAND)
317
+ $(VERBOSE)echo -e "\rPreprocessing and compiling SPE \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
318
+ $(VERBOSE)$(CC) -c $(CFLAGS) -mno-regnames -S -o $@_in $< $(LOG_COMMAND)
319
+ $(VERBOSE)$(BUILD_DIR)/PatchForSPE $@_in
[email protected] >/dev/null
320
+ $(VERBOSE)$(CC) $(CFLAGS) -c
[email protected] -o $@ $(LOG_COMMAND)
321
+ $(VERBOSE)-$(DELETE) $@_in
[email protected]
297
322
endef
298
323
299
324
define COMPILE_SHARED_SPE
300
325
$(VERBOSE)@$(MAKEDIR) $(@D)
301
- $(VERBOSE)echo -e "\rCompiling Shared SPE \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
302
- $(VERBOSE)$(CC) -mspe -mcpu=8540 -mfloat-gprs=double -mabi=spe $(PIC) -o $@ -c $< $(LOG_COMMAND)
326
+ $(VERBOSE)echo -e "\rPreprocessing and compiling SPE \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
327
+ $(VERBOSE)$(CC) -c $(PIC) -mabi=spe $(CFLAGS) -mno-regnames -S -o $@_in $< $(LOG_COMMAND)
328
+ $(VERBOSE)$(BUILD_DIR)/PatchForSPE $@_in
[email protected] >/dev/null
329
+ $(VERBOSE)$(CC) $(PIC) -mabi=spe $(CFLAGS) -c
[email protected] -o $@ $(LOG_COMMAND)
330
+ $(VERBOSE)-$(DELETE) $@_in
[email protected]
303
331
endef
304
332
305
333
define MAKELIB
@@ -314,46 +342,55 @@ define MAKESHARED
314
342
$(VERBOSE)@$(MAKEDIR) $(@D)
315
343
$(VERBOSE)@$(DELETE) $@
316
344
$(VERBOSE)echo -e "\rMaking Shared \033[0;31m$@\033[0m"
317
- $(VERBOSE)$(CC) -nostdlib -mcrt=clib2 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $^ $(OUTPUT_LIB)/shcrtend.o $(LOG_COMMAND) -Wl,-soname,$(@F)
345
+ $(VERBOSE)$(CC) -nostdlib -mcrt=clib4 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $^ $(OUTPUT_LIB)/shcrtend.o $(LOG_COMMAND) -Wl,-soname,$(@F)
318
346
endef
319
347
348
+ PatchForSPE : $(LIB_ROOT)/misc/PatchForSPE.cpp
349
+ $(HOST_CXX) -o $(BUILD_DIR)/$@ $<
350
+
351
+ ifdef SPE
352
+ .NOTPARALLEL: PatchForSPE
353
+ endif
354
+
320
355
compile-tests:
321
356
+make -C $(LIB_ROOT)/test_programs; CC="$(CC)" CXX="$(CXX)" COPY="$(COPY)" DELETE="$(DELETE)" MAKEDIR="$(MAKEDIR)"
322
357
323
358
install:
324
359
$(DELETE) $(INSTALL_PREFIX)/include/*
325
360
$(DELETE) $(INSTALL_PREFIX)/lib/*
361
+ $(DELETE) $(INSTALL_PREFIX)/clib4.library*
326
362
$(COPY) $(OUTPUT_LIB)/* $(INSTALL_PREFIX)/lib/
327
363
$(COPY) libs/libauto.a $(INSTALL_PREFIX)/lib/
364
+ $(COPY) $(BUILD_DIR)/clib4.library* $(INSTALL_PREFIX)
328
365
$(COPY) $(LIB_ROOT)/library/include/* $(INSTALL_PREFIX)/include/
329
366
330
367
release:
331
- -$(DELETE) clib2 .lha
332
- -$(DELETE) clib2 .info
333
- -$(MAKEDIR) clib2 /include
334
- -$(MAKEDIR) clib2 /lib
335
- -$(COPY) *.md clib2 /
336
- -$(COPY) LICENSE* clib2 /
337
- -$(COPY) installer/Install* clib2 /
338
- -$(COPY) installer/clib2 .info .
339
- -$(COPY) installer/README.md.info clib2 /
340
- -$(COPY) $(BUILD_DIR)/clib2 .library clib2 /
341
- -$(COPY) misc clib2 /
342
- -$(COPY) libs/libauto.a clib2 /lib/
343
- -$(COPY) $(OUTPUT_LIB)/* clib2 /lib/
344
- -$(COPY) $(LIB_ROOT)/library/include/* clib2 /include/
345
- jlha -aqo7i clib2 .lha clib2 clib2 .info
346
- -$(DELETE) clib2
347
- -$(DELETE) clib2 .info
368
+ -$(DELETE) clib4 .lha
369
+ -$(DELETE) clib4 .info
370
+ -$(MAKEDIR) clib4 /include
371
+ -$(MAKEDIR) clib4 /lib
372
+ -$(COPY) *.md clib4 /
373
+ -$(COPY) LICENSE* clib4 /
374
+ -$(COPY) installer/Install* clib4 /
375
+ -$(COPY) installer/clib4 .info .
376
+ -$(COPY) installer/README.md.info clib4 /
377
+ -$(COPY) $(BUILD_DIR)/clib4 .library clib4 /
378
+ -$(COPY) misc clib4 /
379
+ -$(COPY) libs/libauto.a clib4 /lib/
380
+ -$(COPY) $(OUTPUT_LIB)/* clib4 /lib/
381
+ -$(COPY) $(LIB_ROOT)/library/include/* clib4 /include/
382
+ lha -ao5i clib4 .lha clib4 clib4 .info
383
+ -$(DELETE) clib4
384
+ -$(DELETE) clib4 .info
348
385
349
386
dpkg:
350
387
-$(DELETE) $(DPKG_LIB)
351
388
-$(DELETE) $(DPKG_LIB).deb
352
- -$(MAKEDIR) $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2 /lib
353
- -$(MAKEDIR) $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2 /include
389
+ -$(MAKEDIR) $(DPKG_LIB)$(INSTALL_PREFIX) /lib
390
+ -$(MAKEDIR) $(DPKG_LIB)$(INSTALL_PREFIX) /include
354
391
-$(MAKEDIR) $(DPKG_LIB)/DEBIAN
355
- -$(COPY) libs/libauto.a $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2 /lib/
356
- -$(COPY) $(OUTPUT_LIB)/* $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2 /lib/
357
- -$(COPY) $(LIB_ROOT)/library/include/* $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2 /include/
392
+ -$(COPY) libs/libauto.a $(DPKG_LIB)$(INSTALL_PREFIX) /lib/
393
+ -$(COPY) $(OUTPUT_LIB)/* $(DPKG_LIB)$(INSTALL_PREFIX) /lib/
394
+ -$(COPY) $(LIB_ROOT)/library/include/* $(DPKG_LIB)$(INSTALL_PREFIX) /include/
358
395
-$(COPY) misc/control $(DPKG_LIB)/DEBIAN/
359
396
dpkg --build $(DPKG_LIB)
0 commit comments