-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.mingw
47 lines (39 loc) · 1003 Bytes
/
Makefile.mingw
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
# GNU Makefile for Win32/Win64 using MinGW/MinGW-w64
#
# to cross-compile, e.g.:
# make CROSS=i686-w64-mingw32
# make CROSS=i686-pc-mingw32
# make CROSS=x86_64-w64-mingw32
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 -g -O2
CFLAGS+=-DNDEBUG
ARFLAGS=crv
CFLAGS_LIB =-DUNSF_BUILD=1
# symbol visibility:
CFLAGS_LIB+=-DDLL_EXPORT=1
LDFLAGS_LIB =-shared -Wl,--no-undefined -Wl,--enable-auto-image-base
LDFLAGS_LIB+=-Wl,--out-implib,libunsf.dll.a
all: unsf.exe
unsf.exe: getopt.o unsf.o libunsf.dll.a
$(CC) $(CFLAGS) -o unsf.exe getopt.o unsf.o -L. -lunsf
libunsf.dll.a: libunsf.dll
libunsf.dll: libunsf.o
$(CC) $(LDFLAGS_LIB) -o libunsf.dll libunsf.o
getopt.o: getopt.c
$(CC) $(CFLAGS) -o getopt.o -c getopt.c
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