blob: dee8e62c29fd6c2a63df995df2221998414c3894 [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
17all:: image stubs
18
19#
20# This is a horrible hack to try to find libgcc.a --- the DLL documentation
21# states that you should just be able to do -lgcc, but modern gcc
22# installation packages don't install /usr/lib/libgcc.a --- as well they
23# shouldn't since libgcc.a can be gcc version dependent.
24# If this hack doesn't work, try replacing it with a hardcoded path to
25# libgcc.a, or -lgcc.
26#
27#DLL_LIBGCC ="`$(CC) -v 2>&1 | head -1 | \
28# sed -e 's;[^/]*;;' -e 's/specs/libgcc.a/'`"
29DLL_LIBGCC ="`$(CC) --print-libgcc-file-name`"
30
31image: $(DLL_IMAGE).so.$(DLL_VERSION)
32
33stubs: $(DLL_STUB).sa $(OBJS)
34
35$(DLL_IMAGE).so.$(DLL_VERSION): $(OBJS)
36 (cd jump; export JUMP_DIR=`pwd`; \
37 $(DLL_BIN)/mkimage -l $(DLL_IMAGE) -v $(DLL_VERSION) \
38 -a $(DLL_ADDRESS) -j $(DLL_JUMPSIZE) -g $(DLL_GOTSIZE) -- \
39 $(OBJS) -lc $(DLL_LIBS) $(DLL_LIBGCC) -lc)
40 mv jump/$(DLL_IMAGE).so.$(DLL_VERSION) .
41
42$(DLL_STUB).sa:
43 (cd jump; export JUMP_DIR=`pwd`; \
44 $(DLL_BIN)/mkstubs -l $(DLL_IMAGE) -v $(DLL_VERSION) \
45 -a $(DLL_ADDRESS) -j $(DLL_JUMPSIZE) -g $(DLL_GOTSIZE) \
46 -- $(DLL_STUB))
47 mv jump/$(DLL_STUB).sa .
48 @$(RM) ../$@
49 @$(LN) $(DLL_MYDIR)/$@ ../$@
50
51install:: $(DLL_IMAGE).so.$(DLL_VERSION)
52 $(INSTALLBIN) $(DLL_IMAGE).so.$(DLL_VERSION) \
53 $(DLL_INSTALL_DIR)/$(DLL_IMAGE).so.$(DLL_VERSION)
54 -ldconfig
55
56install-libs:: $(DLL_STUB).sa
57 $(INSTALLLIB) $(DLL_STUB).sa $(LIBDIR)/$(DLL_STUB).sa
58 $(CHMOD) 644 $(LIBDIR)/$(DLL_STUB).sa
59 $(RANLIB) $(LIBDIR)/$(DLL_STUB).sa
60 $(CHMOD) $(LIBMODE) $(LIBDIR)/$(DLL_STUB).sa
61
62install-tree:: $(DLL_IMAGE).so.$(DLL_VERSION)
63 rm -f ../../shlibs/$(DLL_IMAGE).so.$(DLL_VERSION)
64 cp $(DLL_IMAGE).so.$(DLL_VERSION) ../../shlibs
65 strip ../../shlibs/$(DLL_IMAGE).so.$(DLL_VERSION)
66 chmod 555 ../../shlibs/$(DLL_IMAGE).so.$(DLL_VERSION)
67
68clean::
69 (cd jump; $(RM) *~ *.o *.s jump.log size.nm)
70 $(RM) ../$(DLL_STUB).sa $(DLL_STUB).sa $(DLL_IMAGE).so.$(DLL_VERSION)