From 3d485deba3dccdaf0d284f30f2b154b48f35dda1 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sat, 4 Sep 2010 10:41:02 +0200 Subject: [PATCH] Unified Makefile --- Projects/Simba/Makefile | 74 ++++++++++++++++++++++++++++ Projects/Simba/Makefile.i386-linux | 35 ------------- Projects/Simba/Makefile.win32 | 31 ------------ Projects/Simba/Makefile.win64 | 31 ------------ Projects/Simba/Makefile.x86_64-linux | 36 -------------- 5 files changed, 74 insertions(+), 133 deletions(-) create mode 100644 Projects/Simba/Makefile delete mode 100644 Projects/Simba/Makefile.i386-linux delete mode 100644 Projects/Simba/Makefile.win32 delete mode 100644 Projects/Simba/Makefile.win64 delete mode 100644 Projects/Simba/Makefile.x86_64-linux diff --git a/Projects/Simba/Makefile b/Projects/Simba/Makefile new file mode 100644 index 0000000..d3fecac --- /dev/null +++ b/Projects/Simba/Makefile @@ -0,0 +1,74 @@ +# Makefile for Simba +# Currently written for and tested to run only on Linux i386 and x86_64. +# Currently supports cross compilation to fpc targets i386-linux x86_64-linux i386-win32 x86_64-win64 +# Obviously your system must have the needed binaries and libraries to cross-compile for that to work, +# but this will of course compile a native binary for your system only if you wish. + +.PHONY: default build rebuild unknown recursive_build clean i386-linux x86_64-linux i386-win32 x86_64-win64 all + +# Set this +#lazaruspath := /usr/lib/lazarus/0.9.28.2 +lazaruspath := /home/mopar/simba/lazarus + +# Shouldn't need to touch below here, unless you add a unit or something... + +# let's detect what linux platform we are running on, so if we run build or the default target +# we by default build the correct executable for our architecture... +# (cross-compiling is near-impossible on windows, so this makefile doesn't need to try and support it) +# as Simba supports more OSs (BSD, OSX etc) we can add support for cross compilation here too +uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') +ifeq ($(uname_S),Linux) + uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') + ifeq ($(uname_M),x86_64) + our_target := x86_64-linux + else ifeq ($(uname_M),i386) + our_target := i386-linux + else + our_target := unknown + endif +else + our_target := unknown +endif + +CC := fpc +build := $(CC) + +# -Xd doesn't seem to cause problems when not cross-compiling, and is needed when cross-compiling, so I'm leaving it here +common_flags := -Xd -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu. -dM_MEMORY_DEBUG -dLCL +units := -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/MMLAddon/PSInc/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../Units/Linux/ -Fu../../Units/Synapse/ -Fu../../Units/RUTIS/ + +binary := Simba.$(platform) +lclplatpath := $(lazaruspath)/lcl/units/$(platform)/ +lazarusunits := -Fu$(lazaruspath)/components/synedit/units/$(platform)/ -Fu$(lazaruspath)ideintf/units/$(platform)/ -Fu$(lclplatpath) -Fu$(lclplatpath)$(widgetset)/ -Fu$(lazaruspath)/packager/units/$(platform)/ -Fu$(lazaruspath)/components/mouseandkeyinput/ + +default: build + +build: $(our_target) + +rebuild: clean build + +recursive_build: $(binary) + +unknown: + @echo Unable to auto-detect the OS and architecture you wish to build for, please specify target manually. + +clean: + rm -f *.o *.ppu Simba.i386-* Simba.x86_64-* + +$(binary): + $(CC) $(common_flags) $(platform_flags) -dLCL$(widgetset) $(units) $(lazarusunits) -o$(binary) Simba.lpr + strip $(binary) + +i386-linux: + $(MAKE) recursive_build platform="i386-linux" widgetset="gtk2" platform_flags="-Tlinux -Pi386 -dUseCThreads" + +x86_64-linux: + $(MAKE) recursive_build platform="x86_64-linux" widgetset="gtk2" platform_flags="-Tlinux -Px86_64 -dUseCThreads" + +i386-win32: + $(MAKE) recursive_build platform="i386-win32" widgetset="win32" platform_flags="-Twin32 -Pi386" + +x86_64-win64: + $(MAKE) recursive_build platform="x86_64-win64" widgetset="win32" platform_flags="-Twin64 -Px86_64" + +all: i386-linux x86_64-linux i386-win32 x86_64-win64 diff --git a/Projects/Simba/Makefile.i386-linux b/Projects/Simba/Makefile.i386-linux deleted file mode 100644 index 4b75e07..0000000 --- a/Projects/Simba/Makefile.i386-linux +++ /dev/null @@ -1,35 +0,0 @@ -#$ fpc -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../../lazarus/components/synedit/units/x86_64-linux/ -Fu../../../lazarus/ideintf/units/x86_64-linux/ -Fu../../../lazarus/lcl/units/x86_64-linux/ -Fu../../../lazarus/lcl/units/x86_64-linux/gtk2/ -Fu../../../lazarus/packager/units/x86_64-linux/ -Fu. -oSAMufasaGUI -dUseCThreads -dM_MEMORY_DEBUG -dLCL -dLCLgtk2 Simba.lpr - -.PHONY: default clean - -#Set these ---------- -platform := i386-linux -widgetset := gtk2 -#lazaruspath := /usr/lib/lazarus/0.9.28.2 -lazaruspath := /home/mopar/simba/lazarus - -#-dUseCThreads on linux, none on windows. :) -platformdefines := -dUseCThreads -#End set there ------- - -CC := fpc -build := $(CC) -binary := Simba.$(platform) -flags := -Pi386 -Xd -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu. -defines := $(platformdefines) -dM_MEMORY_DEBUG -dLCL -dLCL$(widgetset) -units := -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/MMLAddon/PSInc/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../Units/Linux/ -Fu../../Units/Synapse/ -Fu../../Units/RUTIS/ - - - -lclplatpath := $(lazaruspath)/lcl/units/$(platform)/ - -lazarusunits := -Fu$(lazaruspath)/components/synedit/units/$(platform)/ -Fu$(lazaruspath)ideintf/units/$(platform)/ -Fu$(lclplatpath) -Fu$(lclplatpath)$(widgetset)/ -Fu$(lazaruspath)/packager/units/$(platform)/ -Fu$(lazaruspath)/components/mouseandkeyinput/ - -default: $(binary) - -clean: - rm -f *.o *.ppu $(binary) - -$(binary): - $(CC) $(flags) $(units) $(lazarusunits) -o$(binary) $(defines) Simba.lpr - strip $(binary) diff --git a/Projects/Simba/Makefile.win32 b/Projects/Simba/Makefile.win32 deleted file mode 100644 index c712409..0000000 --- a/Projects/Simba/Makefile.win32 +++ /dev/null @@ -1,31 +0,0 @@ -#$ fpc -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../../lazarus/components/synedit/units/x86_64-linux/ -Fu../../../lazarus/ideintf/units/x86_64-linux/ -Fu../../../lazarus/lcl/units/x86_64-linux/ -Fu../../../lazarus/lcl/units/x86_64-linux/gtk2/ -Fu../../../lazarus/packager/units/x86_64-linux/ -Fu. -oSAMufasaGUI -dUseCThreads -dM_MEMORY_DEBUG -dLCL -dLCLgtk2 Simba.lpr - -.PHONY: default clean - -#Set these ---------- -platform := i386-win32 -widgetset := win32 -#lazaruspath := /usr/lib/lazarus/0.9.28.2 -lazaruspath := /home/mopar/simba/lazarus - -CC := fpc -build := $(CC) -binary := Simba.$(platform).exe -flags := -Twin32 -Pi386 -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu. -defines := $(platformdefines) -dM_MEMORY_DEBUG -dLCL -dLCL$(widgetset) -units := -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/MMLAddon/PSInc/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../Units/Linux/ -Fu../../Units/Synapse/ -Fu../../Units/RUTIS/ - - - -lclplatpath := $(lazaruspath)/lcl/units/$(platform)/ - -lazarusunits := -Fu$(lazaruspath)/components/synedit/units/$(platform)/ -Fu$(lazaruspath)ideintf/units/$(platform)/ -Fu$(lclplatpath) -Fu$(lclplatpath)$(widgetset)/ -Fu$(lazaruspath)/packager/units/$(platform)/ -Fu$(lazaruspath)/components/mouseandkeyinput/ - -default: $(binary) - -clean: - rm -f *.o *.ppu $(binary) - -$(binary): - $(CC) $(flags) $(units) $(lazarusunits) -o$(binary) $(defines) Simba.lpr - strip $(binary) diff --git a/Projects/Simba/Makefile.win64 b/Projects/Simba/Makefile.win64 deleted file mode 100644 index 873e2b5..0000000 --- a/Projects/Simba/Makefile.win64 +++ /dev/null @@ -1,31 +0,0 @@ -#$ fpc -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../../lazarus/components/synedit/units/x86_64-linux/ -Fu../../../lazarus/ideintf/units/x86_64-linux/ -Fu../../../lazarus/lcl/units/x86_64-linux/ -Fu../../../lazarus/lcl/units/x86_64-linux/gtk2/ -Fu../../../lazarus/packager/units/x86_64-linux/ -Fu. -oSAMufasaGUI -dUseCThreads -dM_MEMORY_DEBUG -dLCL -dLCLgtk2 Simba.lpr - -.PHONY: default clean - -#Set these ---------- -platform := x86_64-win64 -widgetset := win32 -#lazaruspath := /usr/lib/lazarus/0.9.28.2 -lazaruspath := /home/mopar/simba/lazarus - -CC := fpc -build := $(CC) -binary := Simba.$(platform).exe -flags := -Twin64 -Px86_64 -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu. -defines := $(platformdefines) -dM_MEMORY_DEBUG -dLCL -dLCL$(widgetset) -units := -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/MMLAddon/PSInc/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../Units/Linux/ -Fu../../Units/Synapse/ -Fu../../Units/RUTIS/ - - - -lclplatpath := $(lazaruspath)/lcl/units/$(platform)/ - -lazarusunits := -Fu$(lazaruspath)/components/synedit/units/$(platform)/ -Fu$(lazaruspath)ideintf/units/$(platform)/ -Fu$(lclplatpath) -Fu$(lclplatpath)$(widgetset)/ -Fu$(lazaruspath)/packager/units/$(platform)/ -Fu$(lazaruspath)/components/mouseandkeyinput/ - -default: $(binary) - -clean: - rm -f *.o *.ppu $(binary) - -$(binary): - $(CC) $(flags) $(units) $(lazarusunits) -o$(binary) $(defines) Simba.lpr - strip $(binary) diff --git a/Projects/Simba/Makefile.x86_64-linux b/Projects/Simba/Makefile.x86_64-linux deleted file mode 100644 index 1a3225f..0000000 --- a/Projects/Simba/Makefile.x86_64-linux +++ /dev/null @@ -1,36 +0,0 @@ -#$ fpc -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../../lazarus/components/synedit/units/x86_64-linux/ -Fu../../../lazarus/ideintf/units/x86_64-linux/ -Fu../../../lazarus/lcl/units/x86_64-linux/ -Fu../../../lazarus/lcl/units/x86_64-linux/gtk2/ -Fu../../../lazarus/packager/units/x86_64-linux/ -Fu. -oSAMufasaGUI -dUseCThreads -dM_MEMORY_DEBUG -dLCL -dLCLgtk2 Simba.lpr - -.PHONY: default clean - -#Set these ---------- -platform := x86_64-linux -widgetset := gtk2 -#lazaruspath := /usr/lib/lazarus/0.9.28.2 -lazaruspath := /home/mopar/simba/lazarus - -#-dUseCThreads on linux, none on windows. :) -platformdefines := -dUseCThreads -#End set there ------- - -CC := fpc -build := $(CC) -binary := Simba.$(platform) -flags := -Px86_64 -MObjFPC -Scgi -O2 -OoREGVAR -gl -vewnhi -l -Fu. -defines := $(platformdefines) -dM_MEMORY_DEBUG -dLCL -dLCL$(widgetset) -units := -Fu../../Units/MMLCore/ -Fu../../Units/MMLAddon/ -Fu../../Units/MMLAddon/PSInc/ -Fu../../Units/PascalScript/ -Fu../../Units/Misc/ -Fu../../Units/Linux/ -Fu../../Units/Synapse/ -Fu../../Units/RUTIS/ - - - -lclplatpath := $(lazaruspath)/lcl/units/$(platform)/ - -lazarusunits := -Fu$(lazaruspath)/components/synedit/units/$(platform)/ -Fu$(lazaruspath)ideintf/units/$(platform)/ -Fu$(lclplatpath) -Fu$(lclplatpath)$(widgetset)/ -Fu$(lazaruspath)/packager/units/$(platform)/ -Fu$(lazaruspath)/components/mouseandkeyinput/ - -default: $(binary) - -clean: - rm -f *.o *.ppu $(binary) - -$(binary): - $(CC) $(flags) $(units) $(lazarusunits) -o$(binary) $(defines) Simba.lpr - strip $(binary) -