diff options
author | Timothy Gu <timothygu99@gmail.com> | 2014-02-07 05:14:03 +0000 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2014-02-07 05:14:03 +0000 |
commit | 3982987839821826b5c9fa2addc960692ee12f53 (patch) | |
tree | 81e7bf0dcdf12dcf506f4cf51c308e662755dfec | |
parent | f92c77180839e46e85d01c2507af6e5859542990 (diff) | |
download | dlfcn-win32-3982987839821826b5c9fa2addc960692ee12f53.tar.gz dlfcn-win32-3982987839821826b5c9fa2addc960692ee12f53.tar.bz2 dlfcn-win32-3982987839821826b5c9fa2addc960692ee12f53.zip |
Makefile: some rework with better dependency tracking
More to come later
-rw-r--r-- | Makefile | 42 |
1 files changed, 24 insertions, 18 deletions
@@ -4,7 +4,7 @@ | |||
4 | include config.mak | 4 | include config.mak |
5 | 5 | ||
6 | ifeq ($(BUILD_SHARED),yes) | 6 | ifeq ($(BUILD_SHARED),yes) |
7 | TARGETS+=libdl.dll | 7 | TARGETS+=libdl.dll libdl.dll.a |
8 | SHFLAGS+=-Wl,--out-implib,libdl.dll.a | 8 | SHFLAGS+=-Wl,--out-implib,libdl.dll.a |
9 | INSTALL+=shared-install | 9 | INSTALL+=shared-install |
10 | endif | 10 | endif |
@@ -13,49 +13,55 @@ ifeq ($(BUILD_STATIC),yes) | |||
13 | INSTALL+=static-install | 13 | INSTALL+=static-install |
14 | endif | 14 | endif |
15 | ifeq ($(BUILD_MSVC),yes) | 15 | ifeq ($(BUILD_MSVC),yes) |
16 | TARGETS+=libdl.lib | ||
16 | SHFLAGS+=-Wl,--output-def,libdl.def | 17 | SHFLAGS+=-Wl,--output-def,libdl.def |
17 | INSTALL+=lib-install | 18 | INSTALL+=lib-install |
18 | endif | 19 | endif |
19 | 20 | ||
21 | LIB_OBJS := dlfcn.o | ||
22 | HEADERS := dlfcn.h | ||
23 | |||
20 | all: $(TARGETS) | 24 | all: $(TARGETS) |
21 | 25 | ||
22 | dlfcn.o: | 26 | %.o: %.c |
23 | $(CC) -o dlfcn.o -c dlfcn.c -Wall -O3 -fomit-frame-pointer | 27 | $(CC) -o $@ -c $< -Wall -O3 -fomit-frame-pointer |
24 | 28 | ||
25 | libdl.a: dlfcn.o | 29 | libdl.a: $(LIB_OBJS) |
26 | $(AR) cru libdl.a dlfcn.o | 30 | $(AR) cru $@ $^ |
27 | $(RANLIB) libdl.a | 31 | $(RANLIB) libdl.a |
28 | 32 | ||
29 | libdl.dll: dlfcn.o | 33 | libdl.dll libdl.dll.a: $(LIB_OBJS) |
30 | $(CC) $(SHFLAGS) -shared -o libdl.dll dlfcn.o | 34 | $(CC) $(SHFLAGS) -shared -o $@ $^ |
35 | |||
36 | libdl.lib: libdl.dll | ||
31 | $(LIBCMD) /machine:i386 /def:libdl.def | 37 | $(LIBCMD) /machine:i386 /def:libdl.def |
32 | 38 | ||
33 | shared-install: | 39 | include-install: $(HEADERS) |
40 | mkdir -p $(DESTDIR)$(incdir) | ||
41 | install -m 644 $^ "$(DESTDIR)$(incdir)" | ||
42 | |||
43 | shared-install: include-install | ||
34 | mkdir -p $(DESTDIR)$(prefix)/bin | 44 | mkdir -p $(DESTDIR)$(prefix)/bin |
35 | cp libdl.dll $(DESTDIR)$(prefix)/bin | 45 | cp libdl.dll $(DESTDIR)$(prefix)/bin |
36 | $(STRIP) $(DESTDIR)$(prefix)/bin/libdl.dll | 46 | $(STRIP) $(DESTDIR)$(prefix)/bin/libdl.dll |
37 | mkdir -p $(DESTDIR)$(libdir) | 47 | mkdir -p $(DESTDIR)$(libdir) |
38 | cp libdl.dll.a $(DESTDIR)$(libdir) | 48 | cp libdl.dll.a $(DESTDIR)$(libdir) |
39 | mkdir -p $(DESTDIR)$(incdir) | ||
40 | cp dlfcn.h $(DESTDIR)$(incdir) | ||
41 | 49 | ||
42 | static-install: | 50 | static-install: include-install |
43 | mkdir -p $(DESTDIR)$(libdir) | 51 | mkdir -p $(DESTDIR)$(libdir) |
44 | cp libdl.a $(DESTDIR)$(libdir) | 52 | cp libdl.a $(DESTDIR)$(libdir) |
45 | mkdir -p $(DESTDIR)$(incdir) | ||
46 | cp dlfcn.h $(DESTDIR)$(incdir) | ||
47 | 53 | ||
48 | lib-install: | 54 | lib-install: $(LIBS) |
49 | mkdir -p $(DESTDIR)$(libdir) | 55 | mkdir -p $(DESTDIR)$(libdir) |
50 | cp libdl.lib $(DESTDIR)$(libdir) | 56 | cp libdl.lib $(DESTDIR)$(libdir) |
51 | 57 | ||
52 | install: $(INSTALL) | 58 | install: $(INSTALL) |
53 | 59 | ||
54 | test.exe: | 60 | test.exe: test.o $(TARGETS) |
55 | $(CC) -o test.exe test.c -L. -ldl | 61 | $(CC) -o $@ $< -L. -ldl |
56 | 62 | ||
57 | testdll.dll: | 63 | testdll.dll: testdll.c |
58 | $(CC) -shared -o testdll.dll testdll.c | 64 | $(CC) -shared -o $@ $^ |
59 | 65 | ||
60 | test: $(TARGETS) test.exe testdll.dll | 66 | test: $(TARGETS) test.exe testdll.dll |
61 | test.exe | 67 | test.exe |