Skip to content

Commit

Permalink
Merge pull request #135 from afxgroup/beta10
Browse files Browse the repository at this point in the history
Beta10
  • Loading branch information
afxgroup authored Jul 4, 2023
2 parents ea6adcd + 605825e commit 28aa4ee
Show file tree
Hide file tree
Showing 716 changed files with 22,099 additions and 11,038 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
*.lha
*.bak
/library/compiler.log
clib2.info
compiler.log
*.map
.vscode
build/
clib2.lha
.idea/
clib2_1.0_amd64
*.deb
150 changes: 112 additions & 38 deletions GNUmakefile.os4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

##############################################################################

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

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

##############################################################################

WARNINGS := \
-Wall -W -Wextra -Wpointer-arith -Wsign-compare -Wmissing-prototypes \
-Wundef -Wmissing-declarations -Wunused -Wwrite-strings -Wno-array-bounds -Wno-missing-braces -Wno-unused-value -Wno-comment \
-Wundef -Wmissing-declarations -Wunused -Wwrite-strings -Wno-unused-value -Wno-comment \
-Wno-deprecated-declarations -Wno-sign-compare -Wno-cast-function-type -Wno-unused-variable -Wno-parentheses -Wno-missing-prototypes \
-Wstrict-aliasing -Wno-shadow -Wno-implicit-fallthrough -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing \
-Wno-type-limits -Werror # -Wbad-function-cast -Wconversion -Wformat
-Wstrict-aliasing -Wno-shadow -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing \
-Wno-type-limits # -Werror -Wbad-function-cast -Wconversion -Wformat

PIC := -fPIC -DPIC
INCLUDES := -I$(LIB_DIR)/include \
-Ilibrary \
-I$(LIB_DIR)/external/include \
-I$(SDK_INCLUDE) \
-I$(LIB_DIR)/debug \
-I$(LIB_DIR)/amiga \
-I$(LIB_DIR)/profile \
-I$(LIB_DIR)/math \
-I$(LIB_DIR)/argz \
-I$(LIB_DIR)/usergroup \
-I$(LIB_DIR)/string \
-I$(LIB_DIR)/ctype \
-I$(LIB_DIR)/stdio \
-I$(LIB_DIR)/stdlib \
-I$(LIB_DIR)/socket \
-I$(LIB_DIR)/unistd \
-I$(LIB_DIR)/time \
-I$(LIB_DIR)/wchar \
-I$(LIB_DIR)/posix \
-I$(LIB_DIR)/termios \
-I$(LIB_DIR)/search \
-I$(LIB_DIR)/debug \
-I$(LIB_DIR)/dirent \
-I$(LIB_DIR)/fcntl \
-I$(LIB_DIR)/inttypes \
-I$(LIB_DIR)/locale \
-I$(LIB_DIR)/dirent \
-I$(LIB_DIR)/math \
-I$(LIB_DIR)/misc \
-I$(LIB_DIR)/mount \
-I$(LIB_DIR)/posix \
-I$(LIB_DIR)/profile \
-I$(LIB_DIR)/usergroup \
-I$(LIB_DIR)/search \
-I$(LIB_DIR)/socket \
-I$(LIB_DIR)/stat \
-I$(LIB_DIR)/mount
-I$(LIB_DIR)/stdio \
-I$(LIB_DIR)/stdlib \
-I$(LIB_DIR)/string \
-I$(LIB_DIR)/termios \
-I$(LIB_DIR)/time \
-I$(LIB_DIR)/unistd \
-I$(LIB_DIR)/wchar

SHARED := $(if $(SHARED),$(SHARED),yes)
STATIC := $(if $(STATIC),$(STATIC),yes)

LARGEDATA := -msdata=data
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
OPTIMIZE := -O3 -mmultiple -mupdate -mstrict-align
LARGEDATA :=
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
OPTIMIZE := -O3 -mregnames -mmultiple -mupdate -mstrict-align

STABS :=
DLIBS :=

ifndef DEBUG
OPTIMIZE += -gstabs -DNDEBUG
OPTIMIZE += $(STABS) -DNDEBUG
else
OPTIMIZE += -gstabs -DDEBUG
DLIBS += $(BUILD_DIR)/lib/libdebug.a
endif

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

VERBOSE := @
ifdef SPE
CFLAGS := $(CFLAGS) -DSPE
endif

VERBOSE ?= @

##############################################################################

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

all: prepare all-targets all-libs
all: prepare all-targets all-libs clib2.library.debug clib2.library

##############################################################################

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

LIBS :=
MAIN_LIB:=
OBJ_C_LIB =
OBJ_C_SRC =
OUT_SHARED_LIB := $(BUILD_DIR)/shared

include libc.gmk
include libm.gmk
include libamiga.gmk
include libdebug.gmk
include libprofile.gmk
include libpthread.gmk
include libcrypt.gmk
include librt.gmk
include shared.gmk

prepare:
-$(MAKEDIR) $(BUILD_DIR)/shared
-$(MAKEDIR) $(INSTALL_PREFIX)/lib
-$(MAKEDIR) $(INSTALL_PREFIX)/include

Expand All @@ -138,8 +156,10 @@ all-targets: \
$(OUTPUT_LIB)/crtend.o \
$(OUTPUT_LIB)/shcrtbegin.o \
$(OUTPUT_LIB)/shcrtend.o \
$(OUT_SHARED_LIB)/shared_library/clib2.o \
$(OUT_SHARED_LIB)/shared_library/math.o \
$(MAIN_LIB)
$(info $(MAIN_LIB))
#$(info $(OBJ_C_SRC))

all-libs: $(LIBS)

Expand All @@ -148,24 +168,41 @@ all-libs: $(LIBS)
# Delete all object files and libraries
clean:
-$(DELETE) $(BUILD_DIR)/obj
-$(DELETE) $(BUILD_DIR)/obj.shared
-$(DELETE) $(BUILD_DIR)/obj.shared
-$(DELETE) $(BUILD_DIR)/shared
-$(DELETE) $(OUTPUT_LIB)
-$(DELETE) $(BUILD_DIR)/compiler.log
-$(DELETE) $(BUILD_DIR)/clib2.library*
-$(DELETE) clib2.lha
-$(DELETE) clib2.bak
-$(DELETE) $(DPKG_LIB)
-$(DELETE) $(DPKG_LIB).deb
-cd test_programs; make clean

##############################################################################

# Update the version numbers bound to the individual libraries
version:
$(COPY) c.lib_rev.rev amiga.lib_rev.rev
$(COPY) c.lib_rev.rev profile.lib_rev.rev
$(COPY) c.lib_rev.rev m.lib_rev.rev
$(COPY) c.lib_rev.rev amiga/amiga.lib_rev.rev
$(COPY) c.lib_rev.rev profile/profile.lib_rev.rev
$(COPY) c.lib_rev.rev math/m.lib_rev.rev
$(COPY) c.lib_rev.rev math/crypt.lib_rev.rev
$(COPY) c.lib_rev.rev math/pthread.lib_rev.rev
bumprev amiga.lib
bumprev c.lib
bumprev profile.lib
bumprev m.lib
bumprev crypt.lib
bumprev pthread.lib

# Shared clib2.library rules

clib2.library.debug: $(OBJ_C_LIB)
$(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

clib2.library: clib2.library.debug
cp $(BUILD_DIR)/$< $(BUILD_DIR)/$@
ppc-amigaos-strip -R.comment -R.sdata2 --strip-unneeded-rel-relocs $(BUILD_DIR)/$@

##############################################################################

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

$(OUTPUT_LIB)/crtbegin.o : CFLAGS += -O0 -fno-aggressive-loop-optimizations
$(OUTPUT_LIB)/crtbegin.o : CFLAGS = -mcrt=clib2 $(STABS) $(OPTIONS) $(INCLUDES) -O0 -fno-aggressive-loop-optimizations
$(OUTPUT_LIB)/crtbegin.o : $(LIB_DIR)/crtbegin.c
$(VERBOSE)$(COMPILE)
-$(COPY) $(OUTPUT_LIB)/crtbegin.o $(INSTALL_PREFIX)/lib/

$(OUTPUT_LIB)/crtend.o : CFLAGS += -O0 -fno-aggressive-loop-optimizations
$(OUTPUT_LIB)/crtend.o : CFLAGS = -mcrt=clib2 -O0 $(OPTIONS) $(INCLUDES) -fno-aggressive-loop-optimizations
$(OUTPUT_LIB)/crtend.o : $(LIB_DIR)/crtend.c
$(VERBOSE)$(COMPILE)
-$(COPY) $(OUTPUT_LIB)/crtend.o $(INSTALL_PREFIX)/lib/

$(OUTPUT_LIB)/shcrtbegin.o : CFLAGS += $(PIC) -O0 -fno-aggressive-loop-optimizations
$(OUTPUT_LIB)/shcrtbegin.o : CFLAGS += $(PIC) $(STABS) -O0 -fno-aggressive-loop-optimizations
$(OUTPUT_LIB)/shcrtbegin.o : $(LIB_DIR)/shcrtbegin.c
$(VERBOSE)$(COMPILE)
-$(COPY) $(OUTPUT_LIB)/shcrtbegin.o $(INSTALL_PREFIX)/lib/
Expand All @@ -220,7 +257,7 @@ endef
define COMPILE_ASM
$(VERBOSE)@$(MAKEDIR) $(@D)
$(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"
$(VERBOSE)$(CC) -o $@ -c $< $(LOG_COMMAND)
$(VERBOSE)$(CC) -o $@ -c $< $(LOG_COMMAND)
endef

define COMPILE_SHARED
Expand All @@ -243,10 +280,28 @@ endef

define COMPILE_REG
$(VERBOSE)@$(MAKEDIR) $(@D)
$(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"
$(VERBOSE)$(CC) -mvrsave -mregnames -DVRSAVE -o $@ -c $< $(LOG_COMMAND)
endef

define COMPILE_ALTIVEC_REG
$(VERBOSE)@$(MAKEDIR) $(@D)
$(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"
$(VERBOSE)$(CC) -maltivec -mabi=altivec -mvrsave -mregnames -DVRSAVE -o $@ -c $< $(LOG_COMMAND)
endef

define COMPILE_SPE
$(VERBOSE)@$(MAKEDIR) $(@D)
$(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"
$(VERBOSE)$(CC) -mspe -mcpu=8540 -mfloat-gprs=double -mabi=spe -o $@ -c $< $(LOG_COMMAND)
endef

define COMPILE_SHARED_SPE
$(VERBOSE)@$(MAKEDIR) $(@D)
$(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"
$(VERBOSE)$(CC) -mspe -mcpu=8540 -mfloat-gprs=double -mabi=spe $(PIC) -o $@ -c $< $(LOG_COMMAND)
endef

define MAKELIB
$(VERBOSE)@$(MAKEDIR) $(@D)
$(VERBOSE)@$(DELETE) $@
Expand All @@ -263,7 +318,7 @@ $(VERBOSE)$(CC) -nostdlib -mcrt=clib2 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $
endef

compile-tests:
cd $(LIB_ROOT)/test_programs; CC="$(CC)" CXX="$(CXX)" COPY="$(COPY)" DELETE="$(DELETE)" MAKEDIR="$(MAKEDIR)" && make
+make -C $(LIB_ROOT)/test_programs; CC="$(CC)" CXX="$(CXX)" COPY="$(COPY)" DELETE="$(DELETE)" MAKEDIR="$(MAKEDIR)"

install:
$(DELETE) $(INSTALL_PREFIX)/include/*
Expand All @@ -274,12 +329,31 @@ install:

release:
-$(DELETE) clib2.lha
-$(DELETE) clib2.info
-$(MAKEDIR) clib2/include
-$(MAKEDIR) clib2/lib
-$(COPY) *.md clib2/
-$(COPY) LICENSE* clib2/
-$(COPY) installer/Install* clib2/
-$(COPY) installer/clib2.info .
-$(COPY) installer/README.md.info clib2/
-$(COPY) $(BUILD_DIR)/clib2.library clib2/
-$(COPY) misc clib2/
-$(COPY) libs/libauto.a clib2/lib/
-$(COPY) $(OUTPUT_LIB)/* clib2/lib/
-$(COPY) $(LIB_ROOT)/library/include/* clib2/include/
jlha -aqo7i clib2.lha clib2
-$(DELETE) clib2
jlha -aqo7i clib2.lha clib2 clib2.info
-$(DELETE) clib2
-$(DELETE) clib2.info

dpkg:
-$(DELETE) $(DPKG_LIB)
-$(DELETE) $(DPKG_LIB).deb
-$(MAKEDIR) $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2/lib
-$(MAKEDIR) $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2/include
-$(MAKEDIR) $(DPKG_LIB)/DEBIAN
-$(COPY) libs/libauto.a $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2/lib/
-$(COPY) $(OUTPUT_LIB)/* $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2/lib/
-$(COPY) $(LIB_ROOT)/library/include/* $(DPKG_LIB)/usr/ppc-amigaos/SDK/clib2/include/
-$(COPY) misc/control $(DPKG_LIB)/DEBIAN/
dpkg --build $(DPKG_LIB)
Loading

0 comments on commit 28aa4ee

Please sign in to comment.