Add a way to build OS X binaries (not .app) through Makefiles

This commit is contained in:
yoshibot 2016-05-18 19:14:53 -05:00
parent 928c6acf4b
commit df89563882
4 changed files with 35 additions and 1 deletions

View File

@ -189,6 +189,10 @@ ifdef FREEBSD
UNIXCOMMON=1
endif
ifdef MACOSX
UNIXCOMMON=1
endif
ifdef NDS
NOPNG=1
NONET=1
@ -588,11 +592,16 @@ ifndef WINDOWSHELL
-$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt
endif
endif
# i dont know why, but the os x executable absolutely hates
# being touched by objcopy. so let's not do it
ifndef MACOSX
ifndef PSP
$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
endif
endif
ifndef NOUPX
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
endif
@ -737,6 +746,11 @@ $(OBJDIR)/%.o: %.c
$(OBJDIR)/%.o: $(INTERFACE)/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
ifdef MACOSX
$(OBJDIR)/%.o: sdl/macosx/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
endif
$(OBJDIR)/%.o: hardware/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@

View File

@ -403,6 +403,17 @@ else
WINDRES=windres
endif
# because Apple screws with us on this
# need to get bintools from homebrew
# need to get gzip from homebrew (it's in dupes)
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
GZIP=/usr/local/bin/gzip
endif
OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)

View File

@ -92,7 +92,7 @@ typedef long ssize_t;
#endif
#ifdef __APPLE_CC__
#define DIRECTFULLSCREEN
#define DIRECTFULLSCREEN 1
#define DEBUG_LOG
#define NOIPX
#endif

View File

@ -56,6 +56,15 @@ ifdef FREEBSD
LIBS+=-lipx -lkvm
endif
#
#here is Mac OS X
#
ifdef MACOSX
OBJS+=$(OBJDIR)/mac_resources.o
OBJS+=$(OBJDIR)/mac_alert.o
LIBS+=-framework CoreFoundation
endif
#
#here is GP2x (arm-gp2x-linux)
#