# Makefile for production Mac OSX engine with linkable gui and thapi under X11

PROCESSOR=procRS60x
PLATFORM=platMacXX11
GUI=X11	
INITIALIZE=if [ ! -x ./cccp ]; then ln -s /usr/libexec/gcc/darwin/ppc/3.3/cpp ./cccp; fi

### Compiler switches
GCCWARNINGFLAGS=-Wall -Wno-format -Wno-unused-value
# With gcc version 1175, based on gcc version 3.1 20020420 (prerelease)
# -O2 causes a translator failure:
# Translator problem src/tran/tloop.c 1010: Bad dest type for temp store
# vPC = 28
#COPTS=-g -fsigned-char -O2 -fno-defer-pop $(GCCWARNINGFLAGS)
COPTS=-arch ppc -g -fsigned-char -O0 -fno-defer-pop $(GCCWARNINGFLAGS)
THREADDEFS=-DNBAPI -DPTHREADS -D_REENTRANT

# removed -traditional-cpp experimentaly
OPTDEFS=-DLOADABLE_GUI=1 -DUSE_VFORK=0 

ASFLAGS=-arch ppc 
DEBUGDEFS=
BASEDEFS=-DFIRENZE -D__ppc__ -D__BIG_ENDIAN__ -DTARGET_CPU_PPC
#
INCLUDEDEFS= -D__APPLE_CPP__ -D__GNUC__  -Isrc/makeplat/macx -F/System/Library/Frameworks/ -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ -I/usr/X11R6/include
CDEFS=$(BASEDEFS) $(OPTDEFS) $(THREADDEFS) $(DEBUGDEFS) $(INCLUDEDEFS)

LIBRARIES= -L/usr/X11R6/lib -lX11 /System/Library/Frameworks/AppKit.framework/AppKit /System/Library/Frameworks/Carbon.framework/Carbon -lobjc -lz -lgcc
NOGUILIBRARIES= /System/Library/Frameworks/AppKit.framework/AppKit /System/Library/Frameworks/Carbon.framework/Carbon -lobjc -lz -lgcc
GUILIBRARIES= -L/usr/X11R6/lib -lX11 /System/Library/Frameworks/AppKit.framework/AppKit /System/Library/Frameworks/Carbon.framework/Carbon -lobjc -lz 
OBJ=o
SHOBJ=so
SPLASH_OBJ=herald.o

### Linker switches
LD = ld
LDFLAGS= -r
LDGUILIBFLAGS=-arch ppc -bundle -dynamic -flat_namespace -undefined suppress -L/usr/X11R6/lib $(THREADLIBS) -lX11 -lm -lobjc 

### Platform options
PLATOPTS=MCPP=./cccp MDPP=./cccp CPP_MSRC='-x assembler-with-cpp'

CCCP=./cccp

include src/makefiles/makefile.generic

SPLASH=bits-vw50-e-4.h
SPLASH_INC=src/makeplat/artwork
 
herald.o: src/plat/x11Splash.c $(SPLASH_INC)/$(SPLASH)
	$(CC) -c -I$(SPLASH_INC) -DSPLASH_H=\"$(SPLASH)\" -fPIC \
	-o herald.o src/plat/x11Splash.c

herald.so: herald.o
	$(LD) -o herald.so -bundle herald.o
