-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.darwin
56 lines (46 loc) · 1.16 KB
/
Makefile.darwin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# GNU Makefile for Mac OS X
#
# to cross-compile, e.g.:
# make CROSS=x86_64-apple-darwin9
# make CROSS=i686-apple-darwin9
# make CROSS=powerpc-apple-darwin9
ifeq ($(CROSS),)
CC=gcc
AS=as
AR=ar
RANLIB=ranlib
else
CC=$(CROSS)-gcc
AS=$(CROSS)-as
AR=$(CROSS)-ar
RANLIB=$(CROSS)-ranlib
endif
CFLAGS =-Wall -std=gnu99 -O2
CFLAGS+=-DNDEBUG
CFLAGS+=-DHAVE_STRTOK_R
# for ppc:
#CFLAGS+=-DWORDS_BIGENDIAN
ARFLAGS=crv
CFLAGS_LIB =-DUNSF_BUILD=1
CFLAGS_LIB+=-fPIC -fno-common
# symbol visibility:
CFLAGS_LIB+=-DSYM_VISIBILITY -fvisibility=hidden
LDFLAGS_LIB =-dynamiclib -Wl,-single_module
# version info
LDFLAGS_LIB+=-Wl,-compatibility_version,1.0 -Wl,-current_version,1.0
# library name
LDFLAGS_LIB+=-Wl,-install_name,"@executable_path/libunsf.dylib"
# specifically for 10.5 and newer:
#CFLAGS+=-mmacosx-version-min=10.5
#LDFLAGS_LIB+=-mmacosx-version-min=10.5
all: unsf
unsf: unsf.o libunsf.dylib
$(CC) $(CFLAGS) -o unsf unsf.o -L. -lunsf
libunsf.dylib: libunsf.o
$(CC) $(LDFLAGS_LIB) -o libunsf.dylib libunsf.o
unsf.o: unsf.c
$(CC) $(CFLAGS) -o unsf.o -c unsf.c
libunsf.o: libunsf.c
$(CC) $(CFLAGS) $(CFLAGS_LIB) -o libunsf.o -c libunsf.c
clean:
$(RM) *.o *.a *.dll *.dylib *.exe unsf