From a7c43f7122886855dce21603361766000f622288 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 1 Nov 2009 13:55:34 -0500 Subject: [PATCH] Universal binary support in build system. Sorta duct-taped, but whatever. --- makefile | 17 ++++++++++++----- makemac.sh | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100755 makemac.sh diff --git a/makefile b/makefile index 542bb59..54b1706 100644 --- a/makefile +++ b/makefile @@ -15,7 +15,18 @@ GLUDIR := GLU LIBOGGDIR := libogg-1.0 LIBVORBISDIR := libvorbis-1.0.1 -EXE := $(RUNDIR)/lugaru-bin + +ifeq ($(strip $(macosx_arch)),) + macosx_arch := i386 +endif + +ifeq ($(strip $(macosx)),true) + EXEEXT := $(macosx_arch) +else + EXEEXT := bin +endif + +EXE := $(RUNDIR)/lugaru-$(EXEEXT) ifeq ($(strip $(macosx)),true) CXX := g++-4.0 @@ -66,7 +77,6 @@ ifeq ($(strip $(macosx)),true) CFLAGS += -mdynamic-no-pic LDFLAGS := -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework Carbon -framework OpenAL APPLDFLAGS := ./libSDL-1.2.0.dylib ./libSDLmain-osx.a - APPLDFLAGS := /usr/local/lib/libSDL-1.2.0.dylib /usr/local/lib/libSDLmain.a ifneq ($(strip $(macosx_arch)),) CFLAGS += -arch $(macosx_arch) LDFLAGS += -arch $(macosx_arch) @@ -308,9 +318,6 @@ $(BINDIR)/%.o : %.c $(EXE) : $(OBJS) $(APPOBJS) @mkdir -p $(dir $@) -#ifeq ($(strip $(macosx)),true) -# ranlib ./libSDLmain-osx.a libSDLmain-osx-ranlib -#endif $(LD) -o $@ $(APPLDFLAGS) $(LDFLAGS) $(OBJS) $(APPOBJS) $(POSTLDFLAGS) clean: diff --git a/makemac.sh b/makemac.sh new file mode 100755 index 0000000..d7f8d11 --- /dev/null +++ b/makemac.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e +set -x + +NCPU=`sysctl -n hw.ncpu` + +for arch in ppc i386 x86_64 ; do + make macosx=true macosx_arch=$arch clean + make macosx=true macosx_arch=$arch -j$NCPU + BINS="$BINS run/lugaru-$arch" +done + +rm -f run/lugaru-bin +lipo -create -o run/lugaru-bin $BINS + -- 2.39.5