aboutsummaryrefslogtreecommitdiff
path: root/Makefile2
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile2')
-rw-r--r--Makefile275
1 files changed, 75 insertions, 0 deletions
diff --git a/Makefile2 b/Makefile2
new file mode 100644
index 0000000..4d11de8
--- /dev/null
+++ b/Makefile2
@@ -0,0 +1,75 @@
1#
2# dlfcn-win32 Makefile
3#
4include config.mak
5
6ifeq ($(BUILD_SHARED),yes)
7 TARGETS += libdl.dll libdl.dll.a
8 SHFLAGS += -Wl,--out-implib,libdl.dll.a
9 INSTALL += shared-install
10endif
11ifeq ($(BUILD_STATIC),yes)
12 TARGETS += libdl.a
13 INSTALL += static-install
14endif
15ifeq ($(BUILD_MSVC),yes)
16 TARGETS += libdl.lib
17 SHFLAGS += -Wl,--output-def,libdl.def
18 INSTALL += lib-install
19endif
20
21LIB_OBJS := dlfcn.o
22HEADERS := dlfcn.h
23
24all: $(TARGETS)
25
26%.o: %.c
27 $(CC) -o $@ -c $< -Wall -O3 -fomit-frame-pointer
28
29libdl.a: $(LIB_OBJS)
30 $(AR) cru $@ $^
31 $(RANLIB) libdl.a
32
33libdl.dll libdl.dll.a: $(LIB_OBJS)
34 $(CC) $(SHFLAGS) -shared -o $@ $^
35
36libdl.lib: libdl.dll
37 $(LIBCMD) /machine:i386 /def:libdl.def
38
39include-install: $(HEADERS)
40 mkdir -p $(DESTDIR)$(incdir)
41 install -m 644 $^ "$(DESTDIR)$(incdir)"
42
43shared-install: include-install
44 mkdir -p $(DESTDIR)$(prefix)/bin
45 cp libdl.dll $(DESTDIR)$(prefix)/bin
46 $(STRIP) $(DESTDIR)$(prefix)/bin/libdl.dll
47 mkdir -p $(DESTDIR)$(libdir)
48 cp libdl.dll.a $(DESTDIR)$(libdir)
49
50static-install: include-install
51 mkdir -p $(DESTDIR)$(libdir)
52 cp libdl.a $(DESTDIR)$(libdir)
53
54lib-install: $(LIBS)
55 mkdir -p $(DESTDIR)$(libdir)
56 cp libdl.lib $(DESTDIR)$(libdir)
57
58install: $(INSTALL)
59
60test.exe: test.o $(TARGETS)
61 $(CC) -o $@ $< -L. -ldl
62
63testdll.dll: testdll.c
64 $(CC) -shared -o $@ $^
65
66test: $(TARGETS) test.exe testdll.dll
67 $(WINE) test.exe
68
69clean::
70 rm -f dlfcn.o libdl.dll libdl.a libdl.def libdl.dll.a libdl.lib libdl.exp test.exe testdll.dll
71
72distclean: clean
73 rm -f config.mak
74
75.PHONY: clean distclean install test