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 UNIXCOMMON=1
endif endif
ifdef MACOSX
UNIXCOMMON=1
endif
ifdef NDS ifdef NDS
NOPNG=1 NOPNG=1
NONET=1 NONET=1
@ -588,11 +592,16 @@ ifndef WINDOWSHELL
-$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt -$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt
endif endif
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 ifndef PSP
$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME) $(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME) $(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME) -$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
endif endif
endif
ifndef NOUPX ifndef NOUPX
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME) -$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
endif endif
@ -737,6 +746,11 @@ $(OBJDIR)/%.o: %.c
$(OBJDIR)/%.o: $(INTERFACE)/%.c $(OBJDIR)/%.o: $(INTERFACE)/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
ifdef MACOSX
$(OBJDIR)/%.o: sdl/macosx/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
endif
$(OBJDIR)/%.o: hardware/%.c $(OBJDIR)/%.o: hardware/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@

View file

@ -403,6 +403,17 @@ else
WINDRES=windres WINDRES=windres
endif 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 OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC) LD=$(CC)

View file

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

View file

@ -56,6 +56,15 @@ ifdef FREEBSD
LIBS+=-lipx -lkvm LIBS+=-lipx -lkvm
endif 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) #here is GP2x (arm-gp2x-linux)
# #