blob: 61e40cc4df5b4c43807f1542be4ffc33960bb4a4 [file] [log] [blame]
Theodore Ts'of3db3561997-04-26 13:34:30 +00001#
2# This is a Makefile stub which handles the creation of Linux DLL-style shared
3# libraries.
4#
5# In order to use this stub, the following makefile variables must be defined.
6#
7# DLL_ADDRESS = 0x80000000
8# DLL_JUMPSIZE = 0x1000
9# DLL_GOTSIZE = 0x1000
10# DLL_VERSION = 1.0
11# DLL_IMAGE = libce
12# DLL_STUB = libcom_err
13# DLL_MYDIR = et
14# DLL_INSTALL_DIR = $(SHLIBDIR)
15#
16
Theodore Ts'o50e1e101997-04-26 13:58:21 +000017all:: jump image stubs
18
19subdirs:: jump jump/jump.funcs jump/jump.ignore jump/jump.import \
20 jump/jump.params jump/jump.undefs jump/jump.vars
21
22jump:
23 mkdir jump
24
25jump/jump.funcs: dll/jump.funcs
26 $(CP) $< $@
27
28jump/jump.ignore: dll/jump.ignore
29 $(CP) $< $@
30
31jump/jump.import: dll/jump.import
32 $(CP) $< $@
33
34jump/jump.params: dll/jump.params
35 $(CP) $< $@
36
37jump/jump.undefs: dll/jump.undefs
38 $(CP) $< $@
39
40jump/jump.vars: dll/jump.vars
41 $(CP) $< $@
Theodore Ts'of3db3561997-04-26 13:34:30 +000042
43#
44# This is a horrible hack to try to find libgcc.a --- the DLL documentation
45# states that you should just be able to do -lgcc, but modern gcc
46# installation packages don't install /usr/lib/libgcc.a --- as well they
47# shouldn't since libgcc.a can be gcc version dependent.
48# If this hack doesn't work, try replacing it with a hardcoded path to
49# libgcc.a, or -lgcc.
50#
51#DLL_LIBGCC ="`$(CC) -v 2>&1 | head -1 | \
52# sed -e 's;[^/]*;;' -e 's/specs/libgcc.a/'`"
53DLL_LIBGCC ="`$(CC) --print-libgcc-file-name`"
54
55image: $(DLL_IMAGE).so.$(DLL_VERSION)
56
57stubs: $(DLL_STUB).sa $(OBJS)
58
59$(DLL_IMAGE).so.$(DLL_VERSION): $(OBJS)
60 (cd jump; export JUMP_DIR=`pwd`; \
61 $(DLL_BIN)/mkimage -l $(DLL_IMAGE) -v $(DLL_VERSION) \
62 -a $(DLL_ADDRESS) -j $(DLL_JUMPSIZE) -g $(DLL_GOTSIZE) -- \
63 $(OBJS) -lc $(DLL_LIBS) $(DLL_LIBGCC) -lc)
Theodore Ts'o50e1e101997-04-26 13:58:21 +000064 $(MV) jump/$(DLL_IMAGE).so.$(DLL_VERSION) .
Theodore Ts'o297f47a1997-04-26 14:25:20 +000065 $(LN) -f $(DLL_IMAGE).so.$(DLL_VERSION) \
66 `echo ../$(DLL_IMAGE).so.$(DLL_VERSION) | \
67 sed -e 's/\.[0-9]*\$$//'`
Theodore Ts'of3db3561997-04-26 13:34:30 +000068
69$(DLL_STUB).sa:
70 (cd jump; export JUMP_DIR=`pwd`; \
71 $(DLL_BIN)/mkstubs -l $(DLL_IMAGE) -v $(DLL_VERSION) \
72 -a $(DLL_ADDRESS) -j $(DLL_JUMPSIZE) -g $(DLL_GOTSIZE) \
73 -- $(DLL_STUB))
Theodore Ts'o50e1e101997-04-26 13:58:21 +000074 $(MV) jump/$(DLL_STUB).sa .
75 $(RM) -f ../$@
76 $(LN) $@ ../$@
Theodore Ts'of3db3561997-04-26 13:34:30 +000077
Theodore Ts'o50e1e101997-04-26 13:58:21 +000078installdirs::
79 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(DLL_INSTALL_DIR)
80
81install-shlibs install:: $(DLL_IMAGE).so.$(DLL_VERSION) installdirs
82 $(INSTALL_PROGRAM) $(DLL_IMAGE).so.$(DLL_VERSION) \
83 $(DESTDIR)$(DLL_INSTALL_DIR)/$(DLL_IMAGE).so.$(DLL_VERSION)
Theodore Ts'o74becf31997-04-26 14:37:06 +000084 $(STRIP) $(DESTDIR)$(DLL_INSTALL_DIR)/$(DLL_IMAGE).so.$(DLL_VERSION)
Theodore Ts'of3db3561997-04-26 13:34:30 +000085 -ldconfig
86
Theodore Ts'o39b50341998-04-01 02:51:21 +000087uninstall-shlibs unistall::
88 $(RM) $(DESTDIR)$(DLL_INSTALL_DIR)/$(DLL_IMAGE).so.$(DLL_VERSION)
89
Theodore Ts'o50e1e101997-04-26 13:58:21 +000090install:: $(DLL_STUB).sa
Theodore Ts'o39b50341998-04-01 02:51:21 +000091 $(INSTALL_DATA) $(DLL_STUB).sa $(DESTDIR)$(libdir)/$(DLL_STUB).sa
92 $(CHMOD) 644 $(DESTDIR)$(libdir)/$(DLL_STUB).sa
93 $(RANLIB) $(DESTDIR)$(libdir)/$(DLL_STUB).sa
94 $(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/$(DLL_STUB).sa
Theodore Ts'of3db3561997-04-26 13:34:30 +000095
96clean::
Theodore Ts'o297f47a1997-04-26 14:25:20 +000097 $(RM) -f ../$(DLL_STUB).sa $(DLL_STUB).sa \
98 $(DLL_IMAGE).so.$(DLL_VERSION) ../$(DLL_IMAGE).so.*
Theodore Ts'o50e1e101997-04-26 13:58:21 +000099 $(RM) -rf jump
Theodore Ts'o297f47a1997-04-26 14:25:20 +0000100
101