Debian Codegraph @

src/Makefile.darwin

raw
1 # GNU Makefile for Mac OS X to build SDL2-compat.
2 #
3
4 # change INCLUDES so it points to SDL3 headers directory:
5 INCLUDES = -Iinclude
6
7 # minimum Mac OS X target
8 DEPLOYMENT_TARGET = 10.9
9
10 ifeq ($(CROSS),)
11 CC = gcc
12 else
13 CC = $(CROSS)-gcc
14 endif
15 LD = $(CC)
16
17 CPPFLAGS = -DNDEBUG -D_THREAD_SAFE -DSDL_INCLUDE_STDBOOL_H
18
19 CFLAGS = -fPIC -fvisibility=hidden -O3 -Wall
20 LDFLAGS = -dynamiclib -Wl,-undefined,error -Wl,-single_module
21 #LDFLAGS+= -Wl,-headerpad_max_install_names
22 LDFLAGS+= -Wl,-install_name,"/usr/local/lib/$(DYLIB)"
23 LDFLAGS+= -Wl,-compatibility_version,3201.0 -Wl,-current_version,3201.70
24 LDLIBS = -Wl,-framework,AppKit
25 # this is needed for x86_64 - cross-gcc might not add it.
26 #LDLIBS += -Wl,-lbundle1.o
27 ifneq ($(DEPLOYMENT_TARGET),)
28 CFLAGS += -mmacosx-version-min=$(DEPLOYMENT_TARGET)
29 LDFLAGS+= -mmacosx-version-min=$(DEPLOYMENT_TARGET)
30 endif
31
32 DYLIB = libSDL2-2.0.0.dylib
33
34 OBJ = sdl2_compat.o dynapi/SDL_dynapi.o sdl2_compat_objc.o
35
36 .SUFFIXES:
37 .SUFFIXES: .o .c .m
38
39 all: $(DYLIB)
40
41 $(DYLIB): $(OBJ)
42 $(LD) -o $@ $(LDFLAGS) $(OBJ) $(LDLIBS)
43 ln -sf $(DYLIB) libSDL2.dylib
44
45 .c.o:
46 $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -o $@ -c $<
47 .m.o:
48 $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -o $@ -c $<
49
50 distclean: clean
51 $(RM) *.dylib
52 clean:
53 $(RM) *.o dynapi/*.o