Update the OS X Puzzles makefile so that it builds on Leopard and

generates PPC/Intel dual-architecture binaries.

This turns out not to be too painful: you compile and link your
programs using `gcc -arch ppc' or `gcc -arch i386', then you use a
command of the form `lipo -create ppc-binary i386-binary -output
binary' to construct a universal binary. It works equally well on
command-line standalone executable files and the executables within
application directories. Also added the -mmacosx-version-min option,
since otherwise the OS X build tools appear to default to building
binaries which will crash (without anything resembling a
comprehensible error message) on any earlier release.

The handling of version.o in this checkin is somewhat grotty. I'd
prefer a method more cleverly intertwingled with mkfiles.pl so I
didn't have to maintain the OS X architecture list in both
mkfiles.pl and Recipe. (Not that I anticipate Apple switching
architectures again in the immediate future, but it's the principle
of the thing.)

[originally from svn r7916]
This commit is contained in:
Simon Tatham
2008-03-11 17:59:38 +00:00
parent ace2c7dafd
commit 7a3549db51
2 changed files with 48 additions and 23 deletions

17
Recipe
View File

@ -119,14 +119,23 @@ FORCE:
# md5sum readily available. We do, however, have `md5 -r' which
# generates _nearly_ the same output, but it has no check function.
!begin osx
version.o: FORCE;
version.ppc.o: FORCE;
FORCE:
if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \
$(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
$(CC) -arch ppc $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c -o version.ppc.o; \
elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \
$(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
$(CC) -arch ppc $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c -o version.ppc.o; \
else \
$(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
$(CC) -arch ppc $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c -o version.ppc.o; \
fi
version.i386.o: FORCE2;
FORCE2:
if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \
$(CC) -arch i386 $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c -o version.i386.o; \
elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \
$(CC) -arch i386 $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c -o version.i386.o; \
else \
$(CC) -arch i386 $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c -o version.i386.o; \
fi
!end
!specialobj osx version