Commit | Line | Data |
---|---|---|
81c4586f PC |
1 | # |
2 | # mman-win32 (mingw32) Makefile | |
3 | # | |
4 | include config.mak | |
5 | ||
6 | CFLAGS=-Wall -O3 -fomit-frame-pointer | |
7 | ||
8 | ifeq ($(BUILD_STATIC),yes) | |
9 | TARGETS+=libmman.a | |
10 | INSTALL+=static-install | |
11 | endif | |
12 | ||
13 | ifeq ($(BUILD_SHARED),yes) | |
14 | TARGETS+=libmman.dll | |
15 | INSTALL+=shared-install | |
16 | CFLAGS+=-DMMAN_LIBRARY_DLL -DMMAN_LIBRARY | |
17 | endif | |
18 | ||
19 | ifeq ($(BUILD_MSVC),yes) | |
20 | SHFLAGS+=-Wl,--output-def,libmman.def | |
21 | INSTALL+=lib-install | |
22 | endif | |
23 | ||
24 | all: $(TARGETS) | |
25 | ||
26 | mman.o: mman.c mman.h | |
27 | $(CC) -o mman.o -c mman.c $(CFLAGS) | |
28 | ||
29 | libmman.a: mman.o | |
30 | $(AR) cru libmman.a mman.o | |
31 | $(RANLIB) libmman.a | |
32 | ||
33 | libmman.dll: mman.o | |
34 | $(CC) -shared -o libmman.dll mman.o -Wl,--out-implib,libmman.dll.a | |
35 | ||
36 | header-install: | |
37 | mkdir -p $(DESTDIR)$(incdir) | |
38 | cp mman.h $(DESTDIR)$(incdir) | |
39 | ||
40 | static-install: header-install | |
41 | mkdir -p $(DESTDIR)$(libdir) | |
42 | cp libmman.a $(DESTDIR)$(libdir) | |
43 | ||
44 | shared-install: header-install | |
45 | mkdir -p $(DESTDIR)$(libdir) | |
46 | cp libmman.dll.a $(DESTDIR)$(libdir) | |
47 | mkdir -p $(DESTDIR)$(bindir) | |
48 | cp libmman.dll $(DESTDIR)$(bindir) | |
49 | ||
50 | lib-install: | |
51 | mkdir -p $(DESTDIR)$(libdir) | |
52 | cp libmman.lib $(DESTDIR)$(libdir) | |
53 | ||
54 | install: $(INSTALL) | |
55 | ||
56 | test.exe: test.c mman.c mman.h | |
57 | $(CC) -o test.exe test.c -L. -lmman | |
58 | ||
59 | test: $(TARGETS) test.exe | |
60 | test.exe | |
61 | ||
62 | clean:: | |
63 | rm -f mman.o libmman.a libmman.dll.a libmman.dll libmman.def libmman.lib test.exe *.dat | |
64 | ||
65 | distclean: clean | |
66 | rm -f config.mak | |
67 | ||
68 | .PHONY: clean distclean install test |