aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile38
1 files changed, 20 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 9f5985e..89c5d68 100644
--- a/Makefile
+++ b/Makefile
@@ -6,13 +6,14 @@ CFLAGS = -Wall -O3 -fomit-frame-pointer
6 6
7ifeq ($(BUILD_SHARED),yes) 7ifeq ($(BUILD_SHARED),yes)
8 TARGETS += libdl.dll 8 TARGETS += libdl.dll
9 SHFLAGS += -Wl,--out-implib,libdl.dll.a 9 SHFLAGS += -Wl,--out-implib,libdl.dll.a -DSHARED
10 CFLAGS += -DSHARED
11 INSTALL += shared-install 10 INSTALL += shared-install
11 TESTS += test.exe
12endif 12endif
13ifeq ($(BUILD_STATIC),yes) 13ifeq ($(BUILD_STATIC),yes)
14 TARGETS += libdl.a 14 TARGETS += libdl.a
15 INSTALL += static-install 15 INSTALL += static-install
16 TESTS += test-static.exe
16endif 17endif
17ifeq ($(BUILD_MSVC),yes) 18ifeq ($(BUILD_MSVC),yes)
18 TARGETS += libdl.lib 19 TARGETS += libdl.lib
@@ -20,20 +21,18 @@ ifeq ($(BUILD_MSVC),yes)
20 INSTALL += lib-install 21 INSTALL += lib-install
21endif 22endif
22 23
23LIB_OBJS := dlfcn.o 24SOURCES := dlfcn.c
24HEADERS := dlfcn.h 25HEADERS := dlfcn.h
25 26
26all: $(TARGETS) 27all: $(TARGETS)
27 28
28%.o: %.c 29libdl.a: $(SOURCES)
29 $(CC) -o $@ -c $< $(CFLAGS) 30 $(CC) $(CFLAGS) -c $^
31 $(AR) cru $@ $(SOURCES:%.c=%.o)
32 $(RANLIB) $@
30 33
31libdl.a: $(LIB_OBJS) 34libdl.dll: $(SOURCES)
32 $(AR) cru $@ $^ 35 $(CC) $(CFLAGS) $(SHFLAGS) -shared -o $@ $^
33 $(RANLIB) libdl.a
34
35libdl.dll: $(LIB_OBJS)
36 $(CC) $(SHFLAGS) -shared -o $@ $^
37 36
38libdl.lib: libdl.dll 37libdl.lib: libdl.dll
39 $(LIBCMD) /machine:i386 /def:libdl.def 38 $(LIBCMD) /machine:i386 /def:libdl.def
@@ -59,27 +58,30 @@ lib-install:
59 58
60install: $(INSTALL) 59install: $(INSTALL)
61 60
62test.exe: test.o $(TARGETS) 61test.exe: test.c $(TARGETS)
63 $(CC) -o $@ $< -L. -ldl 62 $(CC) $(CFLAGS) -o $@ $< libdl.dll.a
63
64test-static.exe: test.c $(TARGETS)
65 $(CC) $(CFLAGS) -o $@ $< libdl.a
64 66
65testdll.dll: testdll.c 67testdll.dll: testdll.c
66 $(CC) -shared -o $@ $^ 68 $(CC) $(CFLAGS) -shared -o $@ $^
67 69
68testdll2.dll: testdll2.c $(TARGETS) 70testdll2.dll: testdll2.c $(TARGETS)
69 $(CC) -shared -o $@ $< -L. -ldl 71 $(CC) $(CFLAGS) -shared -o $@ $< -L. -ldl
70 72
71testdll3.dll: testdll3.c 73testdll3.dll: testdll3.c
72 $(CC) -shared -o $@ $^ 74 $(CC) -shared -o $@ $^
73 75
74test: $(TARGETS) test.exe testdll.dll testdll2.dll testdll3.dll 76test: $(TARGETS) $(TESTS) testdll.dll testdll2.dll testdll3.dll
75 $(WINE) test.exe 77 for test in $(TESTS); do $(WINE) $$test || exit 1; done
76 78
77clean:: 79clean::
78 rm -f \ 80 rm -f \
79 dlfcn.o \ 81 dlfcn.o \
80 libdl.dll libdl.a libdl.def libdl.dll.a libdl.lib libdl.exp \ 82 libdl.dll libdl.a libdl.def libdl.dll.a libdl.lib libdl.exp \
81 tmptest.c tmptest.dll \ 83 tmptest.c tmptest.dll \
82 test.exe testdll.dll testdll2.dll testdll3.dll 84 test.exe test-static.exe testdll.dll testdll2.dll testdll3.dll
83 85
84distclean: clean 86distclean: clean
85 rm -f config.mak 87 rm -f config.mak