--- Makefile.orig Sat Jun 3 15:26:12 2000 +++ Makefile Wed Oct 18 09:30:03 2000 @@ -51,13 +51,13 @@ LIBDIRS=-L. -L/usr/local/lib -L/usr/lib/X11 -L/usr/X11R6/lib #Location where libgd.a should be installed by "make install". -INSTALL_LIB=/usr/local/lib +INSTALL_LIB=$(prefix)/lib #Location where .h files should be installed by "make install". -INSTALL_INCLUDE=/usr/local/include +INSTALL_INCLUDE=$(prefix)/include #Location where useful non-test programs should be installed by "make install". -INSTALL_BIN=/usr/local/bin +INSTALL_BIN=$(prefix)/bin # # @@ -75,26 +75,36 @@ BIN_PROGRAMS=pngtogd pngtogd2 gdtopng gd2topng gd2copypal gdparttopng webpng TEST_PROGRAMS=gdtest gddemo gd2time gdtestttf -all: libgd.a $(PROGRAMS) +PICFLAG= -fpic +SHLIB= libgd.so.18.3 +.if defined(NO_SHARED_LIB) && ${NO_SHARED_LIB:L} == "yes" +all: libgd.a $(PROGRAMS) install: libgd.a $(BIN_PROGRAMS) - sh ./install-item 644 libgd.a $(INSTALL_LIB)/libgd.a - sh ./install-item 755 pngtogd $(INSTALL_BIN)/pngtogd - sh ./install-item 755 pngtogd2 $(INSTALL_BIN)/pngtogd2 - sh ./install-item 755 gdtopng $(INSTALL_BIN)/gdtopng - sh ./install-item 755 gd2topng $(INSTALL_BIN)/gd2topng - sh ./install-item 755 gd2copypal $(INSTALL_BIN)/gd2copypal - sh ./install-item 755 gdparttopng $(INSTALL_BIN)/gdparttopng - sh ./install-item 755 webpng $(INSTALL_BIN)/webpng - sh ./install-item 755 bdftogd $(INSTALL_BIN)/bdftogd - sh ./install-item 644 gd.h $(INSTALL_INCLUDE)/gd.h - sh ./install-item 644 gdcache.h $(INSTALL_INCLUDE)/gdcache.h - sh ./install-item 644 gd_io.h $(INSTALL_INCLUDE)/gd_io.h - sh ./install-item 644 gdfontg.h $(INSTALL_INCLUDE)/gdfontg.h - sh ./install-item 644 gdfontl.h $(INSTALL_INCLUDE)/gdfontl.h - sh ./install-item 644 gdfontmb.h $(INSTALL_INCLUDE)/gdfontmb.h - sh ./install-item 644 gdfonts.h $(INSTALL_INCLUDE)/gdfonts.h - sh ./install-item 644 gdfontt.h $(INSTALL_INCLUDE)/gdfontt.h +.else +all: libgd.a $(SHLIB) $(PROGRAMS) +install: libgd.a $(SHLIB) $(BIN_PROGRAMS) +.endif + $(BSD_INSTALL_DATA) libgd.a $(DESTDIR)$(INSTALL_LIB) + @if [ -f $(SHLIB) ]; then \ + $(BSD_INSTALL_DATA) $(SHLIB) $(DESTDIR)$(INSTALL_LIB); \ + fi + $(BSD_INSTALL_PROGRAM) pngtogd $(DESTDIR)$(INSTALL_BIN) + $(BSD_INSTALL_PROGRAM) pngtogd2 $(DESTDIR)$(INSTALL_BIN) + $(BSD_INSTALL_PROGRAM) gdtopng $(DESTDIR)$(INSTALL_BIN) + $(BSD_INSTALL_PROGRAM) gd2topng $(DESTDIR)$(INSTALL_BIN) + $(BSD_INSTALL_PROGRAM) gd2copypal $(DESTDIR)$(INSTALL_BIN) + $(BSD_INSTALL_PROGRAM) gdparttopng $(DESTDIR)$(INSTALL_BIN) + $(BSD_INSTALL_PROGRAM) webpng $(DESTDIR)$(INSTALL_BIN) + $(BSD_INSTALL_PROGRAM) bdftogd $(DESTDIR)$(INSTALL_BIN) + $(BSD_INSTALL_DATA) gd.h $(DESTDIR)$(INSTALL_INCLUDE) + $(BSD_INSTALL_DATA) gdcache.h $(DESTDIR)$(INSTALL_INCLUDE) + $(BSD_INSTALL_DATA) gd_io.h $(DESTDIR)$(INSTALL_INCLUDE) + $(BSD_INSTALL_DATA) gdfontg.h $(DESTDIR)$(INSTALL_INCLUDE) + $(BSD_INSTALL_DATA) gdfontl.h $(DESTDIR)$(INSTALL_INCLUDE) + $(BSD_INSTALL_DATA) gdfontmb.h $(DESTDIR)$(INSTALL_INCLUDE) + $(BSD_INSTALL_DATA) gdfonts.h $(DESTDIR)$(INSTALL_INCLUDE) + $(BSD_INSTALL_DATA) gdfontt.h $(DESTDIR)$(INSTALL_INCLUDE) gddemo: gddemo.o libgd.a $(CC) gddemo.o -o gddemo $(LIBDIRS) $(LIBS) @@ -129,17 +139,21 @@ gdtestttf: gdtestttf.o libgd.a $(CC) gdtestttf.o -o gdtestttf $(LIBDIRS) $(LIBS) -libgd.a: gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o gd_io_file.o gd_ss.o \ +OBJS= gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o gd_io_file.o gd_ss.o \ gd_io_ss.o gd_png.o gd_jpeg.o gdxpm.o gdfontt.o gdfonts.o gdfontmb.o gdfontl.o \ - gdfontg.o gdtables.o gdttf.o gdcache.o gdkanji.o wbmp.o gd_wbmp.o \ - gd.h gdfontt.h gdfonts.h gdfontmb.h gdfontl.h gdfontg.h - rm -f libgd.a - $(AR) rc libgd.a gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o \ - gd_io_file.o gd_ss.o gd_io_ss.o gd_png.o gd_jpeg.o gdxpm.o \ - gdfontt.o gdfonts.o gdfontmb.o gdfontl.o gdfontg.o \ - gdtables.o gdttf.o gdcache.o gdkanji.o wbmp.o gd_wbmp.o - -ranlib libgd.a + gdfontg.o gdtables.o gdttf.o gdcache.o gdkanji.o wbmp.o gd_wbmp.o +SHOBJS= $(OBJS:.o=.so) + +.SUFFIXES: .o .so + +libgd.a: $(OBJS) + $(AR) rc libgd.a $(OBJS) +$(SHLIB): $(SHOBJS) + $(CC) -shared $(PICFLAG) -o $(SHLIB) $(SHOBJS) + clean: - rm -f *.o *.a ${PROGRAMS} test/gdtest.jpg test/gdtest.wbmp + rm -f *.o *.so ${PROGRAMS} libgd.a $(SHLIB) test/gdtest.jpg test/gdtest.wbmp +.c.so: + $(CC) $(CFLAGS) $(PICFLAG) -DPIC -c $? -o $@