mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
193 lines
5.3 KiB
Makefile
193 lines
5.3 KiB
Makefile
#
|
|
# $Id: GNUmakefile.os4,v 1.116 2008-11-06 14:44:07 obarthel Exp $
|
|
#
|
|
# vim:ts=8 ft=make:
|
|
#
|
|
# -*- mode: makefile; -*-
|
|
|
|
##############################################################################
|
|
|
|
.PHONY : all all-targets clean version cvs-tag
|
|
|
|
# You may have to change the following sets of macro definitions which will
|
|
# be used throughout the build makefile. These definitions cover the paths
|
|
# to look into for the operating system and networking header files, and
|
|
# the names and parameters passed to the program which actually do the
|
|
# compilation, library building and cleanup work.
|
|
#
|
|
# Note that for either set you still need the GNU make utility to build the
|
|
# library!
|
|
|
|
# These are for the cross compiler, with the operating system header files
|
|
# stored in "/V/include" and the network header files in a local directory
|
|
# called "netinclude".
|
|
SDK_INCLUDE := /V/include
|
|
NET_INCLUDE := netinclude
|
|
CC := ppc-amigaos-gcc
|
|
AR := ppc-amigaos-ar -q
|
|
RANLIB := ppc-amigaos-ranlib
|
|
COPY := cp -p
|
|
DELETE := rm -rf
|
|
MAKEDIR := mkdir -p
|
|
LOG_COMMAND := 2>&1 | tee -a compiler.log
|
|
# You may need to request a specific compiler version in order to
|
|
# build the baserel versions of the library. At this time of
|
|
# writing (2008-11-06) GCC 4.0.4 and below support the -mbaserel
|
|
# feature, but more recent versions, including GCC 4.2.4, do not.
|
|
#COMPILER_VERSION := -V4.0.2
|
|
|
|
# The following are for the native OS4 compiler; note that the
|
|
# LOG_COMMAND should not be enabled unless you have a shell
|
|
# installed which supports it.
|
|
#SDK_INCLUDE := /SDK/Include/include_h
|
|
#NET_INCLUDE := /SDK/Include/netinclude
|
|
#CC := distcc gcc
|
|
#AR := ar -q
|
|
#RANLIB := ranlib
|
|
#COPY := copy
|
|
#DELETE := delete all quiet force
|
|
#MAKEDIR := makedir all force
|
|
#COMPILER_VERSION := -V4.0.2
|
|
#LOG_COMMAND := *>< | tee >>compiler.log
|
|
|
|
##############################################################################
|
|
|
|
WARNINGS := \
|
|
-Wall -W -Wpointer-arith -Wsign-compare -Wmissing-prototypes \
|
|
-Wundef -Wbad-function-cast -Wmissing-declarations -Wunused -Wwrite-strings \
|
|
-Wno-deprecated-declarations \
|
|
|
|
# -Wconversion -Wshadow
|
|
|
|
INCLUDES := -Iinclude -I. -I$(SDK_INCLUDE)
|
|
OPTIONS := -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99 -mcrt=clib2
|
|
OPTIMIZE := -DNDEBUG -O3
|
|
|
|
#DEBUG := -ggdb
|
|
#MEMDEBUG := -D__USE_MEM_TREES -D__MEM_DEBUG
|
|
|
|
CFLAGS := $(COMPILER_VERSION) $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(MEMDEBUG) $(OPTIONS) $(INCLUDES)
|
|
AFLAGS := $(COMPILER_VERSION) -Wa,-mregnames
|
|
|
|
LARGEDATA := -msdata=data
|
|
SOFTFLOAT := -msdata=data -msoft-float
|
|
SMALLDATA := -msdata=sysv -DSMALL_DATA
|
|
BASEREL := -mbaserel -DBASEREL_DATA
|
|
THREADSAFE := -D__THREAD_SAFE
|
|
|
|
##############################################################################
|
|
|
|
# This is the first target: it depends on all the targets
|
|
|
|
all: all-targets
|
|
|
|
##############################################################################
|
|
|
|
# The LIBS variable is updated by each of the included library makefiles.
|
|
|
|
LIBS :=
|
|
|
|
include libc.gmk
|
|
include libunix.gmk
|
|
include libm.gmk
|
|
include libnet.gmk
|
|
include libdebug.gmk
|
|
include libamiga.gmk
|
|
include libprofile.gmk
|
|
|
|
##############################################################################
|
|
|
|
# General build rules for all object files and the individual libraries
|
|
|
|
define generic_rule
|
|
|
|
LIBS += lib/$(1)crt0.o \
|
|
lib/$(1)crtbegin.o \
|
|
lib/$(1)crtend.o \
|
|
lib.threadsafe/$(1)crt0.o \
|
|
lib.threadsafe/$(1)crtbegin.o \
|
|
lib.threadsafe/$(1)crtend.o
|
|
|
|
lib/$(1)%.o : AFLAGS += $(2)
|
|
lib/$(1)%.o : %.S
|
|
@$$(ASSEMBLE)
|
|
|
|
lib/$(1)%.o : CFLAGS += $(2)
|
|
lib/$(1)%.o : %.c
|
|
@$$(COMPILE)
|
|
|
|
lib.threadsafe/$(1)%.o : AFLAGS += $(THREADSAFE) $(2)
|
|
lib.threadsafe/$(1)%.o : %.S
|
|
@$$(ASSEMBLE)
|
|
|
|
lib.threadsafe/$(1)%.o : CFLAGS += $(THREADSAFE) $(2)
|
|
lib.threadsafe/$(1)%.o : %.c
|
|
@$$(COMPILE)
|
|
|
|
endef
|
|
|
|
$(eval $(call generic_rule,,$(LARGEDATA)))
|
|
$(eval $(call generic_rule,small-data/,$(SMALLDATA)))
|
|
$(eval $(call generic_rule,soft-float/,$(SOFTFLOAT)))
|
|
$(eval $(call generic_rule,baserel/,$(BASEREL)))
|
|
|
|
##############################################################################
|
|
|
|
all-targets: $(LIBS)
|
|
|
|
##############################################################################
|
|
|
|
# Delete all object files and libraries
|
|
clean:
|
|
-$(DELETE) obj
|
|
-$(DELETE) obj.threadsafe
|
|
-$(DELETE) lib
|
|
-$(DELETE) lib.threadsafe
|
|
-$(DELETE) compiler.log
|
|
|
|
##############################################################################
|
|
|
|
# Update the version numbers bound to the individual libraries
|
|
version:
|
|
$(COPY) c.lib_rev.rev amiga.lib_rev.rev
|
|
$(COPY) c.lib_rev.rev debug.lib_rev.rev
|
|
$(COPY) c.lib_rev.rev m.lib_rev.rev
|
|
$(COPY) c.lib_rev.rev net.lib_rev.rev
|
|
$(COPY) c.lib_rev.rev unix.lib_rev.rev
|
|
$(COPY) c.lib_rev.rev profile.lib_rev.rev
|
|
bumprev 1 amiga.lib
|
|
bumprev 1 c.lib
|
|
bumprev 1 debug.lib
|
|
bumprev 1 m.lib
|
|
bumprev 1 net.lib
|
|
bumprev 1 unix.lib
|
|
bumprev 1 profile.lib
|
|
|
|
##############################################################################
|
|
|
|
# Tag all files with a certain version number
|
|
cvs-tag:
|
|
cvs -q tag V1_`cat c.lib_rev.rev`
|
|
|
|
##############################################################################
|
|
|
|
define COMPILE
|
|
-$(MAKEDIR) $(@D)
|
|
echo "Compiling $< [$(@D)]"
|
|
$(CC) $(CFLAGS) -o $@ -c $< $(LOG_COMMAND)
|
|
endef
|
|
|
|
define ASSEMBLE
|
|
-$(MAKEDIR) $(@D)
|
|
echo "Assembling $< [$(@D)]"
|
|
$(CC) $(AFLAGS) -o $@ -c $< $(LOG_COMMAND)
|
|
endef
|
|
|
|
define MAKELIB
|
|
-$(MAKEDIR) $@
|
|
$(DELETE) $@
|
|
echo "Making $@"
|
|
$(AR) $@ $^ $(LOG_COMMAND)
|
|
$(RANLIB) $@ $(LOG_COMMAND)
|
|
endef
|