# GNU Makefile for Mac OS X to build SDL12-compat.
#
# change INCLUDES so it points to SDL2 headers directory:
INCLUDES = -Iinclude
ifeq ($(CROSS),)
CC = gcc
else
CC = $(CROSS)-gcc
endif
LD = $(CC)
CPPFLAGS = -DNDEBUG -D_THREAD_SAFE
CPPFLAGS+= -DSDL_DISABLE_IMMINTRIN_H
CFLAGS = -mmacosx-version-min=10.6 -fPIC -O3 -Wall
LDFLAGS = -mmacosx-version-min=10.6 -dynamiclib -Wl,-undefined,error -Wl,-single_module
#LDFLAGS+= -Wl,-headerpad_max_install_names
LDFLAGS+= -Wl,-install_name,"/usr/local/lib/$(DYLIB)"
LDFLAGS+= -Wl,-compatibility_version,1.0 -Wl,-current_version,12.68
LDLIBS = -Wl,-framework,AppKit
# this is needed for x86_64 - cross-gcc might not add it.
#LDLIBS += -Wl,-lbundle1.o
DYLIB = libSDL-1.2.0.dylib
OBJ = SDL12_compat.o SDL12_compat_objc.o
.SUFFIXES:
.SUFFIXES: .o .c .m
all: $(DYLIB)
$(DYLIB): $(OBJ)
$(LD) -o $@ $(LDFLAGS) $(OBJ) $(LDLIBS)
ln -sf $(DYLIB) libSDL.dylib
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -o $@ -c $<
.m.o:
$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -o $@ -c $<
distclean: clean
$(RM) *.dylib
clean:
$(RM) *.o