blob: abeab7e9eb7a9a30b5eb32ef3bad8a3bf236aedd (
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
69
70
71
72
73
74
75
76
77
|
#
# dlfcn-win32 Makefile
#
include config.mak
ifeq ($(BUILD_SHARED),yes)
TARGETS+=libdl.dll
SHFLAGS+=-Wl,--out-implib,libdl.dll.a
INSTALL+=shared-install
endif
ifeq ($(BUILD_STATIC),yes)
TARGETS+=libdl.a
INSTALL+=static-install
endif
ifeq ($(BUILD_MSVC),yes)
SHFLAGS+=-Wl,--output-def,libdl.def
LIBCMD=lib
INSTALL+=lib-install
else
LIBCMD=echo ignoring lib
endif
ifeq ($(DO_STRIP),yes)
STRIP=strip
else
STRIP=echo ignoring strip
endif
all: $(TARGETS)
dlfcn.o:
$(CC) -o dlfcn.o -c dlfcn.c -O3 -fomit-frame-pointer
libdl.a: dlfcn.o
ar cru libdl.a dlfcn.o
ranlib libdl.a
libdl.dll: dlfcn.o
$(CC) $(SHFLAGS) -shared -o libdl.dll dlfcn.o
$(LIBCMD) /machine:i386 /def:libdl.def
shared-install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp libdl.dll $(DESTDIR)$(PREFIX)/bin
$(STRIP) $(DESTDIR)$(PREFIX)/bin/libdl.dll
mkdir -p $(DESTDIR)$(libdir)
cp libdl.dll.a $(DESTDIR)$(libdir)
mkdir -p $(DESTDIR)$(incdir)
cp dlfcn.h $(DESTDIR)$(incdir)
static-install:
mkdir -p $(DESTDIR)$(libdir)
cp libdl.a $(DESTDIR)$(libdir)
mkdir -p $(DESTDIR)$(incdir)
cp dlfcn.h $(DESTDIR)$(incdir)
lib-install:
mkdir -p $(DESTDIR)$(libdir)
cp libdl.lib $(DESTDIR)$(libdir)
install: $(INSTALL)
test.exe:
$(CC) -o test.exe test.c -L. -ldl
testdll.dll:
$(CC) -shared -o testdll.dll testdll.c
test: $(TARGETS) test.exe testdll.dll
test.exe
clean::
rm -f dlfcn.o libdl.dll libdl.a libdl.def libdl.dll.a libdl.lib libdl.exp test.exe testdll.dll
distclean: clean
rm -f config.mak
.PHONY: clean distclean install test
|