Skip to content

Commit

Permalink
Merge pull request #148 from afxgroup/beta10
Browse files Browse the repository at this point in the history
Merge beta10 into master
  • Loading branch information
afxgroup committed Oct 4, 2023
2 parents 28aa4ee + a877cb5 commit 6afaaf8
Show file tree
Hide file tree
Showing 1,687 changed files with 26,654 additions and 16,395 deletions.
Empty file modified .github/workflows/purge_artifacts.sh
100644 → 100755
Empty file.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
*.lha
*.bak
/library/compiler.log
clib2.info
clib4.info
compiler.log
*.map
.vscode
build/
clib2.lha
clib4.lha
.idea/
clib2_1.0_amd64
*.deb
clib4_1.0_amd64
*.deb
clib4/
143 changes: 90 additions & 53 deletions GNUmakefile.os4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Id: Makefile,v 2.1 2021-03-26 11:28:07 clib2devs Exp $
# $Id: Makefile,v 2.1 2021-03-26 11:28:07 clib4devs Exp $
#
# :ts=8
#
Expand All @@ -23,13 +23,16 @@
# called "netinclude".
UNAME := $(shell uname)

INSTALL_PREFIX ?= /usr/ppc-amigaos/SDK/clib2
INSTALL_PREFIX ?= /usr/ppc-amigaos/SDK/clib4
SDK_INCLUDE ?= /usr/ppc-amigaos/SDK/include

CC := ppc-amigaos-gcc
AR := ppc-amigaos-ar -q
LD := ppc-amigaos-ld
RANLIB := ppc-amigaos-ranlib
STRIP := ppc-amigaos-strip
RANLIB := ppc-amigaos-ranlib
HOST_CXX := g++

# On AmigaOS use native commands
ifeq ($(UNAME), AmigaOS)
Expand All @@ -51,16 +54,16 @@ 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
DPKG_LIB = clib4_1.0_amd64

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

WARNINGS := \
-Wall -W -Wextra -Wpointer-arith -Wsign-compare -Wmissing-prototypes \
-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 \
-Wundef -Wmissing-declarations -Wunused -Wwrite-strings -Wno-unused-value -Wno-comment -Wno-missing-braces \
-Wno-deprecated-declarations -Wno-sign-compare -Wno-unused-variable -Wno-parentheses -Wno-missing-prototypes \
-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
-Wno-type-limits -Wno-cast-function-type -Werror # -Wbad-function-cast -Wconversion -Wformat

PIC := -fPIC -DPIC
INCLUDES := -I$(LIB_DIR)/include \
Expand All @@ -78,10 +81,12 @@ INCLUDES := -I$(LIB_DIR)/include \
-I$(LIB_DIR)/math \
-I$(LIB_DIR)/misc \
-I$(LIB_DIR)/mount \
-I$(LIB_DIR)/ndbm \
-I$(LIB_DIR)/posix \
-I$(LIB_DIR)/profile \
-I$(LIB_DIR)/usergroup \
-I$(LIB_DIR)/search \
-I$(LIB_DIR)/shared_library \
-I$(LIB_DIR)/socket \
-I$(LIB_DIR)/stat \
-I$(LIB_DIR)/stdio \
Expand All @@ -96,8 +101,8 @@ SHARED := $(if $(SHARED),$(SHARED),yes)
STATIC := $(if $(STATIC),$(STATIC),yes)

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
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
OPTIMIZE := -O3 -mregnames -mmultiple -mupdate -ffp-contract=fast -mstrict-align

STABS :=
DLIBS :=
Expand All @@ -111,10 +116,15 @@ endif

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

ifdef SPE
CFLAGS := $(CFLAGS) -DSPE
CC := ppc-amigaos-gcc-6.4.0
AS := ppc-amigaos-as-6.4.0
CMATH := -mfpu=dp_lite
CFLAGS := $(CFLAGS) -D__SPE__ -mspe -mtune=8540 -mcpu=8540 -mabi=spe -mfloat-gprs=double $(CMATH) -fno-inline-functions -fno-partial-inlining \
-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
AFLAGS := $(AFLAGS) -mvrsave -D__SPE__ -mspe -mtune=8540 -mcpu=8540 -mfloat-gprs=double $(CMATH) -Wno-overflow
endif

VERBOSE ?= @
Expand All @@ -123,7 +133,7 @@ VERBOSE ?= @

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

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

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

Expand All @@ -150,16 +160,21 @@ prepare:
-$(MAKEDIR) $(INSTALL_PREFIX)/lib
-$(MAKEDIR) $(INSTALL_PREFIX)/include

all-targets: \
ALL_TARGETS = \
$(OUTPUT_LIB)/crt0.o \
$(OUTPUT_LIB)/crtbegin.o \
$(OUTPUT_LIB)/crtend.o \
$(OUTPUT_LIB)/shcrtbegin.o \
$(OUTPUT_LIB)/shcrtend.o \
$(OUT_SHARED_LIB)/shared_library/clib2.o \
$(OUT_SHARED_LIB)/shared_library/clib4.o \
$(OUT_SHARED_LIB)/shared_library/math.o \
$(MAIN_LIB)
#$(info $(OBJ_C_SRC))

ifdef SPE
ALL_TARGETS := PatchForSPE | $(ALL_TARGETS)
endif

all-targets: $(ALL_TARGETS)

all-libs: $(LIBS)

Expand All @@ -170,11 +185,12 @@ clean:
-$(DELETE) $(BUILD_DIR)/obj
-$(DELETE) $(BUILD_DIR)/obj.shared
-$(DELETE) $(BUILD_DIR)/shared
-$(DELETE) $(BUILD_DIR)/PatchForSPE
-$(DELETE) $(OUTPUT_LIB)
-$(DELETE) $(BUILD_DIR)/compiler.log
-$(DELETE) $(BUILD_DIR)/clib2.library*
-$(DELETE) clib2.lha
-$(DELETE) clib2.bak
-$(DELETE) $(BUILD_DIR)/clib4.library*
-$(DELETE) clib4.lha
-$(DELETE) clib4.bak
-$(DELETE) $(DPKG_LIB)
-$(DELETE) $(DPKG_LIB).deb
-cd test_programs; make clean
Expand All @@ -195,14 +211,14 @@ version:
bumprev crypt.lib
bumprev pthread.lib

# Shared clib2.library rules
# Shared clib4.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)/$@.map -nostartfiles -nostdlib
clib4.library.debug: $(OBJ_C_LIB)
$(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)/$@.map -nostartfiles -nostdlib

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

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

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

$(OUTPUT_LIB)/crtbegin.o : CFLAGS = -mcrt=clib2 $(STABS) $(OPTIONS) $(INCLUDES) -O0 -fno-aggressive-loop-optimizations
$(OUTPUT_LIB)/crtbegin.o : CFLAGS = -mcrt=clib4 $(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 = -mcrt=clib2 -O0 $(OPTIONS) $(INCLUDES) -fno-aggressive-loop-optimizations
$(OUTPUT_LIB)/crtend.o : CFLAGS = -mcrt=clib4 -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/
Expand All @@ -250,14 +266,14 @@ endef

define COMPILE_INLINE
$(VERBOSE)@$(MAKEDIR) $(@D)
$(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"
$(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"
$(VERBOSE)$(CC) $(CFLAGS_N) -Wno-missing-prototypes -Wno-missing-declarations -D__timespec_defined -o $@ -c $< $(LOG_COMMAND)
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 Down Expand Up @@ -290,16 +306,28 @@ $(VERBOSE)echo -e "\rAssembling altivec \033[0;33m[$(@D)]\033[0m \r\t\t\t\t\t\t\
$(VERBOSE)$(CC) -maltivec -mabi=altivec -mvrsave -mregnames -DVRSAVE -o $@ -c $< $(LOG_COMMAND)
endef

define COMPILE_SPE_REG
$(VERBOSE)@$(MAKEDIR) $(@D)
$(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"
$(VERBOSE)$(CC) $(AFLAGS) -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)
$(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"
$(VERBOSE)$(CC) -c $(CFLAGS) -mno-regnames -S -o $@_in $< $(LOG_COMMAND)
$(VERBOSE)$(BUILD_DIR)/PatchForSPE $@_in $@.S >/dev/null
$(VERBOSE)$(CC) $(CFLAGS) -c $@.S -o $@ $(LOG_COMMAND)
$(VERBOSE)-$(DELETE) $@_in $@.S
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)
$(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"
$(VERBOSE)$(CC) -c $(PIC) -mabi=spe $(CFLAGS) -mno-regnames -S -o $@_in $< $(LOG_COMMAND)
$(VERBOSE)$(BUILD_DIR)/PatchForSPE $@_in $@.S >/dev/null
$(VERBOSE)$(CC) $(PIC) -mabi=spe $(CFLAGS) -c $@.S -o $@ $(LOG_COMMAND)
$(VERBOSE)-$(DELETE) $@_in $@.S
endef

define MAKELIB
Expand All @@ -314,46 +342,55 @@ define MAKESHARED
$(VERBOSE)@$(MAKEDIR) $(@D)
$(VERBOSE)@$(DELETE) $@
$(VERBOSE)echo -e "\rMaking Shared \033[0;31m$@\033[0m"
$(VERBOSE)$(CC) -nostdlib -mcrt=clib2 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $^ $(OUTPUT_LIB)/shcrtend.o $(LOG_COMMAND) -Wl,-soname,$(@F)
$(VERBOSE)$(CC) -nostdlib -mcrt=clib4 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $^ $(OUTPUT_LIB)/shcrtend.o $(LOG_COMMAND) -Wl,-soname,$(@F)
endef

PatchForSPE : $(LIB_ROOT)/misc/PatchForSPE.cpp
$(HOST_CXX) -o $(BUILD_DIR)/$@ $<

ifdef SPE
.NOTPARALLEL: PatchForSPE
endif

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

install:
$(DELETE) $(INSTALL_PREFIX)/include/*
$(DELETE) $(INSTALL_PREFIX)/lib/*
$(DELETE) $(INSTALL_PREFIX)/clib4.library*
$(COPY) $(OUTPUT_LIB)/* $(INSTALL_PREFIX)/lib/
$(COPY) libs/libauto.a $(INSTALL_PREFIX)/lib/
$(COPY) $(BUILD_DIR)/clib4.library* $(INSTALL_PREFIX)
$(COPY) $(LIB_ROOT)/library/include/* $(INSTALL_PREFIX)/include/

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 clib2.info
-$(DELETE) clib2
-$(DELETE) clib2.info
-$(DELETE) clib4.lha
-$(DELETE) clib4.info
-$(MAKEDIR) clib4/include
-$(MAKEDIR) clib4/lib
-$(COPY) *.md clib4/
-$(COPY) LICENSE* clib4/
-$(COPY) installer/Install* clib4/
-$(COPY) installer/clib4.info .
-$(COPY) installer/README.md.info clib4/
-$(COPY) $(BUILD_DIR)/clib4.library clib4/
-$(COPY) misc clib4/
-$(COPY) libs/libauto.a clib4/lib/
-$(COPY) $(OUTPUT_LIB)/* clib4/lib/
-$(COPY) $(LIB_ROOT)/library/include/* clib4/include/
lha -ao5i clib4.lha clib4 clib4.info
-$(DELETE) clib4
-$(DELETE) clib4.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)$(INSTALL_PREFIX)/lib
-$(MAKEDIR) $(DPKG_LIB)$(INSTALL_PREFIX)/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) libs/libauto.a $(DPKG_LIB)$(INSTALL_PREFIX)/lib/
-$(COPY) $(OUTPUT_LIB)/* $(DPKG_LIB)$(INSTALL_PREFIX)/lib/
-$(COPY) $(LIB_ROOT)/library/include/* $(DPKG_LIB)$(INSTALL_PREFIX)/include/
-$(COPY) misc/control $(DPKG_LIB)/DEBIAN/
dpkg --build $(DPKG_LIB)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BSD 3-Clause License

Copyright (c) 2016, Olaf Barthel
Copyright (c) 2021, Clib2Developers
Copyright (c) 2021, Clib4Developers
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 5 additions & 5 deletions POSIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| <arpa/inet.h> | Functions for manipulating numeric IP addresses (part of Berkley sockets) | Complete |
| <assert.h> | Verify assumptions | Complete |
| <complex.h> | Complex Arithmetic | Complete |
| <cpio.h> | Magic numbers for the cpio archive format | Not present |
| <cpio.h> | Magic numbers for the cpio archive format | Complete |
| <ctype.h> | Character types | Complete | |
| <dirent.h> | Allows the opening and listing of directories | Complete |
| <dlfcn.h> | Dynamic linking | Complete |
Expand All @@ -27,7 +27,7 @@
| <math.h> | Mathematical declarations | Complete |
| <monetary.h> | String formatting of monetary units | Not present |
| <mqueue.h> | Message queue | Not present |
| <ndbm.h> | NDBM database operations | Not present |
| <ndbm.h> | NDBM database operations | Complete |
| <net/if.h> | Listing of local network interfaces | Complete |
| <netdb.h> | Translating protocol and host names into numeric addresses (part of Berkeley sockets | Complete |
| <netinet/in.h> | Defines Internet protocol and address family (part of Berkley sockets) | Complete |
Expand Down Expand Up @@ -66,11 +66,11 @@
| <sys/times.h> | File access and modification times | Complete |
| <sys/types.h> | Various data types used elsewhere | Complete |
| <sys/uio.h> | Vectored I/O operations | Complete |
| <sys/un.h> | Unix domain sockets | Present with missing functions |
| <sys/un.h> | Unix domain sockets | Complete |
| <sys/utsname.h> | Operating system information, including uname | Complete |
| <sys/wait.h> | Status of terminated child processes | Present with missing functions |
| <syslog.h> | System error logging | Not present |
| <tar.h> | Magic numbers for the tar archive format | Not present |
| <syslog.h> | System error logging | Complete |
| <tar.h> | Magic numbers for the tar archive format | Complete |
| <termios.h> | Allows terminal I/O interfaces | Complete |
| <tgmath.h> | Type-Generic Macros | Complete |
| <time.h> | Type-Generic Macros | Complete |
Expand Down
Loading

0 comments on commit 6afaaf8

Please sign in to comment.