Skip to content

Commit

Permalink
Hacks for building Universal Binaries on Mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jan 27, 2006
1 parent 4cb84a1 commit bdcfcff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Makefile
Expand Up @@ -2,7 +2,7 @@
# Quick Makefile by ryan c. gordon. (icculus@clutteredmind.org)

CC := gcc
LINKER := gcc
LD := gcc
BINDIR := bin
SRCDIR := .

Expand Down Expand Up @@ -54,6 +54,9 @@ ifeq ($(strip $(use_pthread)),true)
endif
endif

CFLAGS += $(EXTRACFLAGS)
LDFLAGS += $(EXTRALDFLAGS)

MOJOPATCHSRCS := mojopatch.c md5.c ui.c ui_carbon.c ui_stdio.c $(PLATFORMSRCS)
OBJS1 := $(MOJOPATCHSRCS:.c=.o)
OBJS2 := $(OBJS1:.cpp=.o)
Expand All @@ -78,7 +81,7 @@ $(BINDIR)/%.o: $(SRCDIR)/%.c
$(CC) -c -o $@ $< $(CFLAGS)

$(BINDIR)/mojopatch : $(BINDIR) $(MOJOPATCHOBJS)
$(LINKER) $(LDFLAGS) -o $@ $(MOJOPATCHOBJS)
$(LD) $(LDFLAGS) -o $@ $(MOJOPATCHOBJS)

$(BINDIR):
mkdir -p $(BINDIR)
Expand Down
15 changes: 15 additions & 0 deletions buildmacuniversal.sh
@@ -0,0 +1,15 @@
#!/bin/sh

# Build a Universal binary, gcc 3.3 on PowerPC and gcc 4 on Intel...
make BINDIR=bin-ppc CC=gcc-3.3 LD=gcc-3.3 EXTRACFLAGS="-arch ppc" EXTRALDFLAGS="-arch ppc" $* || exit 1
make BINDIR=bin-i386 CC=gcc-4.0 LD=gcc-4.0 EXTRACFLAGS="-arch i386" EXTRALDFLAGS="-arch i386" $* || exit 1

mkdir -p bin
for feh in `ls bin-ppc` ; do
echo "Gluing bin-ppc/$feh and bin-i386/$feh into bin/$feh ..."
lipo -create -o bin/$feh bin-ppc/$feh bin-i386/$feh
done

rm -rf bin-ppc bin-i386
exit 0

0 comments on commit bdcfcff

Please sign in to comment.