Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame^] | 1 | # |
| 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 | |
| 17 | all:: 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/'`" |
| 29 | DLL_LIBGCC ="`$(CC) --print-libgcc-file-name`" |
| 30 | |
| 31 | image: $(DLL_IMAGE).so.$(DLL_VERSION) |
| 32 | |
| 33 | stubs: $(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 | |
| 51 | install:: $(DLL_IMAGE).so.$(DLL_VERSION) |
| 52 | $(INSTALLBIN) $(DLL_IMAGE).so.$(DLL_VERSION) \ |
| 53 | $(DLL_INSTALL_DIR)/$(DLL_IMAGE).so.$(DLL_VERSION) |
| 54 | -ldconfig |
| 55 | |
| 56 | install-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 | |
| 62 | install-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 | |
| 68 | clean:: |
| 69 | (cd jump; $(RM) *~ *.o *.s jump.log size.nm) |
| 70 | $(RM) ../$(DLL_STUB).sa $(DLL_STUB).sa $(DLL_IMAGE).so.$(DLL_VERSION) |