aboutsummaryrefslogtreecommitdiff
path: root/deps/mman/Makefile
blob: f6af3617ff78e3ec8ae50c794e46f5b9202fdeb1 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
#
# mman-win32 (mingw32) Makefile
#
include config.mak

CFLAGS=-Wall -O3 -fomit-frame-pointer

ifeq ($(BUILD_STATIC),yes)
	TARGETS+=libmman.a
	INSTALL+=static-install
endif

ifeq ($(BUILD_SHARED),yes)
	TARGETS+=libmman.dll
	INSTALL+=shared-install
	CFLAGS+=-DMMAN_LIBRARY_DLL -DMMAN_LIBRARY
endif

ifeq ($(BUILD_MSVC),yes)
	SHFLAGS+=-Wl,--output-def,libmman.def
	INSTALL+=lib-install
endif

all: $(TARGETS)

mman.o: mman.c mman.h
	$(CC) -o mman.o -c mman.c $(CFLAGS)

libmman.a: mman.o
	$(AR) cru libmman.a mman.o
	$(RANLIB) libmman.a

libmman.dll: mman.o
	$(CC) -shared -o libmman.dll mman.o -Wl,--out-implib,libmman.dll.a

header-install:
	mkdir -p $(DESTDIR)$(incdir)
	cp mman.h $(DESTDIR)$(incdir)

static-install: header-install
	mkdir -p $(DESTDIR)$(libdir)
	cp libmman.a $(DESTDIR)$(libdir)

shared-install: header-install
	mkdir -p $(DESTDIR)$(libdir)
	cp libmman.dll.a $(DESTDIR)$(libdir)
	mkdir -p $(DESTDIR)$(bindir)
	cp libmman.dll $(DESTDIR)$(bindir)

lib-install:
	mkdir -p $(DESTDIR)$(libdir)
	cp libmman.lib $(DESTDIR)$(libdir)

install: $(INSTALL)

test.exe: test.c mman.c mman.h
	$(CC) -o test.exe test.c -L. -lmman

test: $(TARGETS) test.exe
	test.exe

clean::
	rm -f mman.o libmman.a libmman.dll.a libmman.dll libmman.def libmman.lib test.exe *.dat

distclean: clean
	rm -f config.mak

.PHONY: clean distclean install test