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 | |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 17 | all:: jump image stubs |
| 18 | |
| 19 | subdirs:: jump jump/jump.funcs jump/jump.ignore jump/jump.import \ |
| 20 | jump/jump.params jump/jump.undefs jump/jump.vars |
| 21 | |
| 22 | jump: |
| 23 | mkdir jump |
| 24 | |
| 25 | jump/jump.funcs: dll/jump.funcs |
| 26 | $(CP) $< $@ |
| 27 | |
| 28 | jump/jump.ignore: dll/jump.ignore |
| 29 | $(CP) $< $@ |
| 30 | |
| 31 | jump/jump.import: dll/jump.import |
| 32 | $(CP) $< $@ |
| 33 | |
| 34 | jump/jump.params: dll/jump.params |
| 35 | $(CP) $< $@ |
| 36 | |
| 37 | jump/jump.undefs: dll/jump.undefs |
| 38 | $(CP) $< $@ |
| 39 | |
| 40 | jump/jump.vars: dll/jump.vars |
| 41 | $(CP) $< $@ |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 42 | |
| 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/'`" |
| 53 | DLL_LIBGCC ="`$(CC) --print-libgcc-file-name`" |
| 54 | |
| 55 | image: $(DLL_IMAGE).so.$(DLL_VERSION) |
| 56 | |
| 57 | stubs: $(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'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 64 | $(MV) jump/$(DLL_IMAGE).so.$(DLL_VERSION) . |
Theodore Ts'o | 297f47a | 1997-04-26 14:25:20 +0000 | [diff] [blame^] | 65 | $(LN) -f $(DLL_IMAGE).so.$(DLL_VERSION) \ |
| 66 | `echo ../$(DLL_IMAGE).so.$(DLL_VERSION) | \ |
| 67 | sed -e 's/\.[0-9]*\$$//'` |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 68 | |
| 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'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 74 | $(MV) jump/$(DLL_STUB).sa . |
| 75 | $(RM) -f ../$@ |
| 76 | $(LN) $@ ../$@ |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 77 | |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 78 | installdirs:: |
| 79 | $(top_srcdir)/mkinstalldirs $(DESTDIR)$(DLL_INSTALL_DIR) |
| 80 | |
| 81 | install-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'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 84 | -ldconfig |
| 85 | |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 86 | install:: $(DLL_STUB).sa |
| 87 | $(INSTALL_DATA) $(DLL_STUB).sa $(DESTDIR)$(ulibdir)/$(DLL_STUB).sa |
| 88 | $(CHMOD) 644 $(DESTDIR)$(ulibdir)/$(DLL_STUB).sa |
| 89 | $(RANLIB) $(DESTDIR)$(ulibdir)/$(DLL_STUB).sa |
| 90 | $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/$(DLL_STUB).sa |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 91 | |
| 92 | clean:: |
Theodore Ts'o | 297f47a | 1997-04-26 14:25:20 +0000 | [diff] [blame^] | 93 | $(RM) -f ../$(DLL_STUB).sa $(DLL_STUB).sa \ |
| 94 | $(DLL_IMAGE).so.$(DLL_VERSION) ../$(DLL_IMAGE).so.* |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 95 | $(RM) -rf jump |
Theodore Ts'o | 297f47a | 1997-04-26 14:25:20 +0000 | [diff] [blame^] | 96 | |
| 97 | |