Skip to content

Commit 28aa4ee

Browse files
authored
Merge pull request #135 from afxgroup/beta10
Beta10
2 parents ea6adcd + 605825e commit 28aa4ee

File tree

716 files changed

+22099
-11038
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

716 files changed

+22099
-11038
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
*.lha
66
*.bak
77
/library/compiler.log
8+
clib2.info
89
compiler.log
910
*.map
1011
.vscode
1112
build/
1213
clib2.lha
1314
.idea/
15+
clib2_1.0_amd64
16+
*.deb

GNUmakefile.os4

+112-38
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
##############################################################################
99

10-
.PHONY : all all-targets clean version cvs-tag
10+
.PHONY : all all-targets clean version release dpkg
1111

1212
# You may have to change the following sets of macro definitions which will
1313
# be used throughout the build makefile. These definitions cover the paths
@@ -51,84 +51,102 @@ LIB_ROOT ?= $(shell pwd)
5151
LIB_DIR = $(LIB_ROOT)/library
5252
BUILD_DIR = $(LIB_ROOT)/build
5353
OUTPUT_LIB = $(BUILD_DIR)/lib
54+
DPKG_LIB = clib2_1.0_amd64
5455

5556
##############################################################################
5657

5758
WARNINGS := \
5859
-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 \
6061
-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
6364

6465
PIC := -fPIC -DPIC
6566
INCLUDES := -I$(LIB_DIR)/include \
6667
-Ilibrary \
6768
-I$(LIB_DIR)/external/include \
6869
-I$(SDK_INCLUDE) \
69-
-I$(LIB_DIR)/debug \
7070
-I$(LIB_DIR)/amiga \
71-
-I$(LIB_DIR)/profile \
72-
-I$(LIB_DIR)/math \
7371
-I$(LIB_DIR)/argz \
74-
-I$(LIB_DIR)/usergroup \
75-
-I$(LIB_DIR)/string \
7672
-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 \
8676
-I$(LIB_DIR)/inttypes \
8777
-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 \
8986
-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
9194

9295
SHARED := $(if $(SHARED),$(SHARED),yes)
9396
STATIC := $(if $(STATIC),$(STATIC),yes)
9497

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 :=
98104

99105
ifndef DEBUG
100-
OPTIMIZE += -gstabs -DNDEBUG
106+
OPTIMIZE += $(STABS) -DNDEBUG
101107
else
102108
OPTIMIZE += -gstabs -DDEBUG
109+
DLIBS += $(BUILD_DIR)/lib/libdebug.a
103110
endif
104111

105112
CFLAGS := $(WARNINGS) $(OPTIMIZE) $(OPTIONS) $(INCLUDES) -D__USE_INLINE__
106113
CFLAGS_N := $(WARNINGS) $(OPTIMIZE) $(OPTIONS) $(INCLUDES)
107114
AFLAGS := -Wa,-mregnames
108115

109-
VERBOSE := @
116+
ifdef SPE
117+
CFLAGS := $(CFLAGS) -DSPE
118+
endif
119+
120+
VERBOSE ?= @
110121

111122
##############################################################################
112123

113124
# This is the first target: it depends on all the targets
114125

115-
all: prepare all-targets all-libs
126+
all: prepare all-targets all-libs clib2.library.debug clib2.library
116127

117128
##############################################################################
118129

119130
# The LIBS variable is updated by each of the included library makefiles.
120131

121132
LIBS :=
122133
MAIN_LIB:=
134+
OBJ_C_LIB =
135+
OBJ_C_SRC =
136+
OUT_SHARED_LIB := $(BUILD_DIR)/shared
123137

124138
include libc.gmk
125139
include libm.gmk
126140
include libamiga.gmk
141+
include libdebug.gmk
127142
include libprofile.gmk
128143
include libpthread.gmk
129144
include libcrypt.gmk
145+
include librt.gmk
146+
include shared.gmk
130147

131148
prepare:
149+
-$(MAKEDIR) $(BUILD_DIR)/shared
132150
-$(MAKEDIR) $(INSTALL_PREFIX)/lib
133151
-$(MAKEDIR) $(INSTALL_PREFIX)/include
134152

@@ -138,8 +156,10 @@ all-targets: \
138156
$(OUTPUT_LIB)/crtend.o \
139157
$(OUTPUT_LIB)/shcrtbegin.o \
140158
$(OUTPUT_LIB)/shcrtend.o \
159+
$(OUT_SHARED_LIB)/shared_library/clib2.o \
160+
$(OUT_SHARED_LIB)/shared_library/math.o \
141161
$(MAIN_LIB)
142-
$(info $(MAIN_LIB))
162+
#$(info $(OBJ_C_SRC))
143163

144164
all-libs: $(LIBS)
145165

@@ -148,24 +168,41 @@ all-libs: $(LIBS)
148168
# Delete all object files and libraries
149169
clean:
150170
-$(DELETE) $(BUILD_DIR)/obj
151-
-$(DELETE) $(BUILD_DIR)/obj.shared
171+
-$(DELETE) $(BUILD_DIR)/obj.shared
172+
-$(DELETE) $(BUILD_DIR)/shared
152173
-$(DELETE) $(OUTPUT_LIB)
153174
-$(DELETE) $(BUILD_DIR)/compiler.log
175+
-$(DELETE) $(BUILD_DIR)/clib2.library*
154176
-$(DELETE) clib2.lha
155177
-$(DELETE) clib2.bak
178+
-$(DELETE) $(DPKG_LIB)
179+
-$(DELETE) $(DPKG_LIB).deb
156180
-cd test_programs; make clean
157181

158182
##############################################################################
159183

160184
# Update the version numbers bound to the individual libraries
161185
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
165191
bumprev amiga.lib
166192
bumprev c.lib
167193
bumprev profile.lib
168194
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)/$@
169206

170207
##############################################################################
171208

@@ -183,17 +220,17 @@ $(OUTPUT_LIB)/crt0.o : $(LIB_DIR)/crt0.S
183220
$(VERBOSE)$(ASSEMBLE)
184221
-$(COPY) $(OUTPUT_LIB)/crt0.o $(INSTALL_PREFIX)/lib/
185222

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
187224
$(OUTPUT_LIB)/crtbegin.o : $(LIB_DIR)/crtbegin.c
188225
$(VERBOSE)$(COMPILE)
189226
-$(COPY) $(OUTPUT_LIB)/crtbegin.o $(INSTALL_PREFIX)/lib/
190227

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
192229
$(OUTPUT_LIB)/crtend.o : $(LIB_DIR)/crtend.c
193230
$(VERBOSE)$(COMPILE)
194231
-$(COPY) $(OUTPUT_LIB)/crtend.o $(INSTALL_PREFIX)/lib/
195232

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
197234
$(OUTPUT_LIB)/shcrtbegin.o : $(LIB_DIR)/shcrtbegin.c
198235
$(VERBOSE)$(COMPILE)
199236
-$(COPY) $(OUTPUT_LIB)/shcrtbegin.o $(INSTALL_PREFIX)/lib/
@@ -220,7 +257,7 @@ endef
220257
define COMPILE_ASM
221258
$(VERBOSE)@$(MAKEDIR) $(@D)
222259
$(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)
224261
endef
225262

226263
define COMPILE_SHARED
@@ -243,10 +280,28 @@ endef
243280

244281
define COMPILE_REG
245282
$(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)
246289
$(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"
247290
$(VERBOSE)$(CC) -maltivec -mabi=altivec -mvrsave -mregnames -DVRSAVE -o $@ -c $< $(LOG_COMMAND)
248291
endef
249292

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+
250305
define MAKELIB
251306
$(VERBOSE)@$(MAKEDIR) $(@D)
252307
$(VERBOSE)@$(DELETE) $@
@@ -263,7 +318,7 @@ $(VERBOSE)$(CC) -nostdlib -mcrt=clib2 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $
263318
endef
264319

265320
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)"
267322

268323
install:
269324
$(DELETE) $(INSTALL_PREFIX)/include/*
@@ -274,12 +329,31 @@ install:
274329

275330
release:
276331
-$(DELETE) clib2.lha
332+
-$(DELETE) clib2.info
277333
-$(MAKEDIR) clib2/include
278334
-$(MAKEDIR) clib2/lib
335+
-$(COPY) *.md clib2/
279336
-$(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/
280341
-$(COPY) misc clib2/
281342
-$(COPY) libs/libauto.a clib2/lib/
282343
-$(COPY) $(OUTPUT_LIB)/* clib2/lib/
283344
-$(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

Comments
 (0)