7
7
8
8
##############################################################################
9
9
10
- .PHONY : all all-targets clean version cvs-tag
10
+ .PHONY : all all-targets clean version release dpkg
11
11
12
12
# You may have to change the following sets of macro definitions which will
13
13
# be used throughout the build makefile. These definitions cover the paths
@@ -51,84 +51,102 @@ LIB_ROOT ?= $(shell pwd)
51
51
LIB_DIR = $(LIB_ROOT)/library
52
52
BUILD_DIR = $(LIB_ROOT)/build
53
53
OUTPUT_LIB = $(BUILD_DIR)/lib
54
+ DPKG_LIB = clib2_1.0_amd64
54
55
55
56
##############################################################################
56
57
57
58
WARNINGS := \
58
59
-Wall -W -Wextra -Wpointer-arith -Wsign-compare -Wmissing-prototypes \
59
- -Wundef -Wmissing-declarations -Wunused -Wwrite-strings -Wno-array-bounds -Wno-missing-braces -Wno- unused-value -Wno-comment \
60
+ -Wundef -Wmissing-declarations -Wunused -Wwrite-strings -Wno-unused-value -Wno-comment \
60
61
-Wno-deprecated-declarations -Wno-sign-compare -Wno-cast-function-type -Wno-unused-variable -Wno-parentheses -Wno-missing-prototypes \
61
- -Wstrict-aliasing -Wno-shadow -Wno-implicit-fallthrough -Wno- discarded-qualifiers -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing \
62
- -Wno-type-limits -Werror # -Wbad-function-cast -Wconversion -Wformat
62
+ -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
63
64
64
65
PIC := -fPIC -DPIC
65
66
INCLUDES := -I$(LIB_DIR)/include \
66
67
-Ilibrary \
67
68
-I$(LIB_DIR)/external/include \
68
69
-I$(SDK_INCLUDE) \
69
- -I$(LIB_DIR)/debug \
70
70
-I$(LIB_DIR)/amiga \
71
- -I$(LIB_DIR)/profile \
72
- -I$(LIB_DIR)/math \
73
71
-I$(LIB_DIR)/argz \
74
- -I$(LIB_DIR)/usergroup \
75
- -I$(LIB_DIR)/string \
76
72
-I$(LIB_DIR)/ctype \
77
- -I$(LIB_DIR)/stdio \
78
- -I$(LIB_DIR)/stdlib \
79
- -I$(LIB_DIR)/socket \
80
- -I$(LIB_DIR)/unistd \
81
- -I$(LIB_DIR)/time \
82
- -I$(LIB_DIR)/wchar \
83
- -I$(LIB_DIR)/posix \
84
- -I$(LIB_DIR)/termios \
85
- -I$(LIB_DIR)/search \
73
+ -I$(LIB_DIR)/debug \
74
+ -I$(LIB_DIR)/dirent \
75
+ -I$(LIB_DIR)/fcntl \
86
76
-I$(LIB_DIR)/inttypes \
87
77
-I$(LIB_DIR)/locale \
88
- -I$(LIB_DIR)/dirent \
78
+ -I$(LIB_DIR)/math \
79
+ -I$(LIB_DIR)/misc \
80
+ -I$(LIB_DIR)/mount \
81
+ -I$(LIB_DIR)/posix \
82
+ -I$(LIB_DIR)/profile \
83
+ -I$(LIB_DIR)/usergroup \
84
+ -I$(LIB_DIR)/search \
85
+ -I$(LIB_DIR)/socket \
89
86
-I$(LIB_DIR)/stat \
90
- -I$(LIB_DIR)/mount
87
+ -I$(LIB_DIR)/stdio \
88
+ -I$(LIB_DIR)/stdlib \
89
+ -I$(LIB_DIR)/string \
90
+ -I$(LIB_DIR)/termios \
91
+ -I$(LIB_DIR)/time \
92
+ -I$(LIB_DIR)/unistd \
93
+ -I$(LIB_DIR)/wchar
91
94
92
95
SHARED := $(if $(SHARED),$(SHARED),yes)
93
96
STATIC := $(if $(STATIC),$(STATIC),yes)
94
97
95
- LARGEDATA := -msdata=data
96
- OPTIONS := $(LARGEDATA) -DHAVE_SYSV -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__CLIB2__ -Wa,-mregnames -fno-builtin -nostdlib -D_GNU_SOURCE -D_XOPEN_SOURCE -D_USE_GNU
97
- OPTIMIZE := -O3 -mmultiple -mupdate -mstrict-align
98
+ 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
101
+
102
+ STABS :=
103
+ DLIBS :=
98
104
99
105
ifndef DEBUG
100
- OPTIMIZE += -gstabs -DNDEBUG
106
+ OPTIMIZE += $(STABS) -DNDEBUG
101
107
else
102
108
OPTIMIZE += -gstabs -DDEBUG
109
+ DLIBS += $(BUILD_DIR)/lib/libdebug.a
103
110
endif
104
111
105
112
CFLAGS := $(WARNINGS) $(OPTIMIZE) $(OPTIONS) $(INCLUDES) -D__USE_INLINE__
106
113
CFLAGS_N := $(WARNINGS) $(OPTIMIZE) $(OPTIONS) $(INCLUDES)
107
114
AFLAGS := -Wa,-mregnames
108
115
109
- VERBOSE := @
116
+ ifdef SPE
117
+ CFLAGS := $(CFLAGS) -DSPE
118
+ endif
119
+
120
+ VERBOSE ?= @
110
121
111
122
##############################################################################
112
123
113
124
# This is the first target: it depends on all the targets
114
125
115
- all: prepare all-targets all-libs
126
+ all: prepare all-targets all-libs clib2.library.debug clib2.library
116
127
117
128
##############################################################################
118
129
119
130
# The LIBS variable is updated by each of the included library makefiles.
120
131
121
132
LIBS :=
122
133
MAIN_LIB:=
134
+ OBJ_C_LIB =
135
+ OBJ_C_SRC =
136
+ OUT_SHARED_LIB := $(BUILD_DIR)/shared
123
137
124
138
include libc.gmk
125
139
include libm.gmk
126
140
include libamiga.gmk
141
+ include libdebug.gmk
127
142
include libprofile.gmk
128
143
include libpthread.gmk
129
144
include libcrypt.gmk
145
+ include librt.gmk
146
+ include shared.gmk
130
147
131
148
prepare:
149
+ -$(MAKEDIR) $(BUILD_DIR)/shared
132
150
-$(MAKEDIR) $(INSTALL_PREFIX)/lib
133
151
-$(MAKEDIR) $(INSTALL_PREFIX)/include
134
152
@@ -138,8 +156,10 @@ all-targets: \
138
156
$(OUTPUT_LIB)/crtend.o \
139
157
$(OUTPUT_LIB)/shcrtbegin.o \
140
158
$(OUTPUT_LIB)/shcrtend.o \
159
+ $(OUT_SHARED_LIB)/shared_library/clib2.o \
160
+ $(OUT_SHARED_LIB)/shared_library/math.o \
141
161
$(MAIN_LIB)
142
- $(info $(MAIN_LIB ))
162
+ # $(info $(OBJ_C_SRC ))
143
163
144
164
all-libs: $(LIBS)
145
165
@@ -148,24 +168,41 @@ all-libs: $(LIBS)
148
168
# Delete all object files and libraries
149
169
clean:
150
170
-$(DELETE) $(BUILD_DIR)/obj
151
- -$(DELETE) $(BUILD_DIR)/obj.shared
171
+ -$(DELETE) $(BUILD_DIR)/obj.shared
172
+ -$(DELETE) $(BUILD_DIR)/shared
152
173
-$(DELETE) $(OUTPUT_LIB)
153
174
-$(DELETE) $(BUILD_DIR)/compiler.log
175
+ -$(DELETE) $(BUILD_DIR)/clib2.library*
154
176
-$(DELETE) clib2.lha
155
177
-$(DELETE) clib2.bak
178
+ -$(DELETE) $(DPKG_LIB)
179
+ -$(DELETE) $(DPKG_LIB).deb
156
180
-cd test_programs; make clean
157
181
158
182
##############################################################################
159
183
160
184
# Update the version numbers bound to the individual libraries
161
185
version:
162
- $(COPY) c.lib_rev.rev amiga.lib_rev.rev
163
- $(COPY) c.lib_rev.rev profile.lib_rev.rev
164
- $(COPY) c.lib_rev.rev m.lib_rev.rev
186
+ $(COPY) c.lib_rev.rev amiga/amiga.lib_rev.rev
187
+ $(COPY) c.lib_rev.rev profile/profile.lib_rev.rev
188
+ $(COPY) c.lib_rev.rev math/m.lib_rev.rev
189
+ $(COPY) c.lib_rev.rev math/crypt.lib_rev.rev
190
+ $(COPY) c.lib_rev.rev math/pthread.lib_rev.rev
165
191
bumprev amiga.lib
166
192
bumprev c.lib
167
193
bumprev profile.lib
168
194
bumprev m.lib
195
+ bumprev crypt.lib
196
+ bumprev pthread.lib
197
+
198
+ # Shared clib2.library rules
199
+
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
202
+
203
+ clib2.library: clib2.library.debug
204
+ cp $(BUILD_DIR)/$< $(BUILD_DIR)/$@
205
+ ppc-amigaos-strip -R.comment -R.sdata2 --strip-unneeded-rel-relocs $(BUILD_DIR)/$@
169
206
170
207
##############################################################################
171
208
@@ -183,17 +220,17 @@ $(OUTPUT_LIB)/crt0.o : $(LIB_DIR)/crt0.S
183
220
$(VERBOSE)$(ASSEMBLE)
184
221
-$(COPY) $(OUTPUT_LIB)/crt0.o $(INSTALL_PREFIX)/lib/
185
222
186
- $(OUTPUT_LIB)/crtbegin.o : CFLAGS += -O0 -fno-aggressive-loop-optimizations
223
+ $(OUTPUT_LIB)/crtbegin.o : CFLAGS = -mcrt=clib2 $(STABS) $(OPTIONS) $(INCLUDES) -O0 -fno-aggressive-loop-optimizations
187
224
$(OUTPUT_LIB)/crtbegin.o : $(LIB_DIR)/crtbegin.c
188
225
$(VERBOSE)$(COMPILE)
189
226
-$(COPY) $(OUTPUT_LIB)/crtbegin.o $(INSTALL_PREFIX)/lib/
190
227
191
- $(OUTPUT_LIB)/crtend.o : CFLAGS + = -O0 -fno-aggressive-loop-optimizations
228
+ $(OUTPUT_LIB)/crtend.o : CFLAGS = -mcrt=clib2 -O0 $(OPTIONS) $(INCLUDES) -fno-aggressive-loop-optimizations
192
229
$(OUTPUT_LIB)/crtend.o : $(LIB_DIR)/crtend.c
193
230
$(VERBOSE)$(COMPILE)
194
231
-$(COPY) $(OUTPUT_LIB)/crtend.o $(INSTALL_PREFIX)/lib/
195
232
196
- $(OUTPUT_LIB)/shcrtbegin.o : CFLAGS += $(PIC) -O0 -fno-aggressive-loop-optimizations
233
+ $(OUTPUT_LIB)/shcrtbegin.o : CFLAGS += $(PIC) $(STABS) -O0 -fno-aggressive-loop-optimizations
197
234
$(OUTPUT_LIB)/shcrtbegin.o : $(LIB_DIR)/shcrtbegin.c
198
235
$(VERBOSE)$(COMPILE)
199
236
-$(COPY) $(OUTPUT_LIB)/shcrtbegin.o $(INSTALL_PREFIX)/lib/
@@ -220,7 +257,7 @@ endef
220
257
define COMPILE_ASM
221
258
$(VERBOSE)@$(MAKEDIR) $(@D)
222
259
$(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"
223
- $(VERBOSE)$(CC) -o $@ -c $< $(LOG_COMMAND)
260
+ $(VERBOSE)$(CC) -o $@ -c $< $(LOG_COMMAND)
224
261
endef
225
262
226
263
define COMPILE_SHARED
@@ -243,10 +280,28 @@ endef
243
280
244
281
define COMPILE_REG
245
282
$(VERBOSE)@$(MAKEDIR) $(@D)
283
+ $(VERBOSE)echo -e "\rAssembling 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"
284
+ $(VERBOSE)$(CC) -mvrsave -mregnames -DVRSAVE -o $@ -c $< $(LOG_COMMAND)
285
+ endef
286
+
287
+ define COMPILE_ALTIVEC_REG
288
+ $(VERBOSE)@$(MAKEDIR) $(@D)
246
289
$(VERBOSE)echo -e "\rAssembling altivec \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\t\t\t\t\t \033[0;31m$(@F)\033[0m"
247
290
$(VERBOSE)$(CC) -maltivec -mabi=altivec -mvrsave -mregnames -DVRSAVE -o $@ -c $< $(LOG_COMMAND)
248
291
endef
249
292
293
+ define COMPILE_SPE
294
+ $(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)
297
+ endef
298
+
299
+ define COMPILE_SHARED_SPE
300
+ $(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)
303
+ endef
304
+
250
305
define MAKELIB
251
306
$(VERBOSE)@$(MAKEDIR) $(@D)
252
307
$(VERBOSE)@$(DELETE) $@
@@ -263,7 +318,7 @@ $(VERBOSE)$(CC) -nostdlib -mcrt=clib2 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $
263
318
endef
264
319
265
320
compile-tests:
266
- cd $(LIB_ROOT)/test_programs; CC="$(CC)" CXX="$(CXX)" COPY="$(COPY)" DELETE="$(DELETE)" MAKEDIR="$(MAKEDIR)" && make
321
+ +make -C $(LIB_ROOT)/test_programs; CC="$(CC)" CXX="$(CXX)" COPY="$(COPY)" DELETE="$(DELETE)" MAKEDIR="$(MAKEDIR)"
267
322
268
323
install:
269
324
$(DELETE) $(INSTALL_PREFIX)/include/*
@@ -274,12 +329,31 @@ install:
274
329
275
330
release:
276
331
-$(DELETE) clib2.lha
332
+ -$(DELETE) clib2.info
277
333
-$(MAKEDIR) clib2/include
278
334
-$(MAKEDIR) clib2/lib
335
+ -$(COPY) *.md clib2/
279
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/
280
341
-$(COPY) misc clib2/
281
342
-$(COPY) libs/libauto.a clib2/lib/
282
343
-$(COPY) $(OUTPUT_LIB)/* clib2/lib/
283
344
-$(COPY) $(LIB_ROOT)/library/include/* clib2/include/
284
- jlha -aqo7i clib2.lha clib2
285
- -$(DELETE) clib2
345
+ jlha -aqo7i clib2.lha clib2 clib2.info
346
+ -$(DELETE) clib2
347
+ -$(DELETE) clib2.info
348
+
349
+ dpkg:
350
+ -$(DELETE) $(DPKG_LIB)
351
+ -$(DELETE) $(DPKG_LIB).deb
352
+ -$(MAKEDIR) $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2/lib
353
+ -$(MAKEDIR) $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2/include
354
+ -$(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/
358
+ -$(COPY) misc/control $(DPKG_LIB)/DEBIAN/
359
+ dpkg --build $(DPKG_LIB)
0 commit comments