ifeq ($(SRCDIR)x,x) SRCDIR = $(CURDIR)/.. BUILDDIR = $(SRCDIR) endif SUBDIR = lib VPATH=.:$(SRCDIR)/$(SUBDIR) DLLTOOL=dlltool include $(BUILDDIR)/Makefile.config ifeq ($(NETPBMLIBTYPE),unixstatic) LIBNETPBM = libnetpbm.$(STATICLIBSUFFIX) else LIBNETPBM = $(NETPBMSHLIBPREFIX)netpbm$(DLLVER).$(NETPBMLIBSUFFIX) endif ifeq ($(STATICLIB_TOO),y) EXTRA_STATICLIB = libnetpbm.$(STATICLIBSUFFIX) else EXTRA_STATICLIB = endif LIBOBJECTS = libpm.o fileio.o bitio.o colorname.o \ libpbm1.o libpbm2.o libpbm3.o libpbmfont.o \ libpgm1.o libpgm2.o \ libppm1.o libppm2.o libppmcmap.o libppmcolor.o libppmd.o \ libppmfloyd.o \ libpnm1.o libpnm2.o libpnm3.o \ libpam.o libpamread.o libpamwrite.o \ libpamn.o libpammap.o libpamcolor.o \ libsystem.o ifneq (${VMS}x,x) LIBOBJECTS += libpbmvms.o endif # Library objects to be linked but not built by Makefile.common: LIBOBJECTS_X = util/shhopt.o util/nstring.o SHLIBOBJECTS = $(patsubst %.o, %.lo, $(LIBOBJECTS)) MANUALS3 = libnetpbm MANUALS5 = pbm pgm ppm pnm pam INTERFACE_HEADERS = pm.h pbm.h bitio.h pbmfont.h \ pgm.h ppm.h ppm.h ppmcmap.h ppmfloyd.h colorname.h \ pnm.h pam.h pammap.h util/shhopt.h util/nstring.h util/mallocvar.h \ pm_system.h pm_gamma.h DATAFILES = rgb.txt HEADERLINKS = pm_config.h version.h compile.h shhopt.h nstring.h mallocvar.h \ bitreverse.h .PHONY: all all: libnetpbm extra_staticlib INCLUDES = -I$(SRCDIR)/$(SUBDIR) -I. SUBDIRS = util SCRIPTS = BINARIES = OMIT_LIBRARY_RULE = 1 include $(SRCDIR)/Makefile.common # The following must go after Makefile.common because $(LIBNETPBM) may # contain a reference to $(NETPBM_MAJOR_RELEASE). .PHONY: libnetpbm libnetpbm: $(LIBNETPBM) .PHONY: extra_staticlib extra_staticlib: $(EXTRA_STATICLIB) #---------------------------------------------------------------------------- # Following are rules for building shared libraries. # Note that the user may specify a shared library as his "main" library # type, but request a static library in addition. #---------------------------------------------------------------------------- $(LIBOBJECTS): %.o: %.c $(HEADERLINKS) # Note that the user may have configured -I options into CFLAGS. $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) \ $(CFLAGS_PERSONAL) $(CADD) -o $@ $< $(SHLIBOBJECTS): %.lo: %.c $(HEADERLINKS) $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) $(CFLAGS_SHLIB) \ $(CFLAGS_PERSONAL) $(CADD) -o $@ $< MAJ = $(NETPBM_MAJOR_RELEASE) MIN = $(NETPBM_MINOR_RELEASE) SONAME = libnetpbm.$(NETPBMLIBSUFFIX).$(SOVER) ifeq ($(NETPBMLIBTYPE),irixshared) # The libxxx.so link is needed to link the executables. libnetpbm.$(NETPBMLIBSUFFIX): $(SONAME) rm -f $@ $(SYMLINK) $< $@ $(SONAME): \ $(LIBOBJECTS) $(LIBOBJECTS_X) $(LD) $(LDSHLIB) -o $@ $(LIBOBJECTS) $(LIBOBJECTS_X) \ -lc \ -soname libnetpbm.$(NETPBMLIBSUFFIX) \ -set_version `perl -e 'print "sgi$(MAJ).".join(":sgi$(MAJ).",(0..$(MIN)))."\n"'` \ $(LADD) endif ifeq ($(NETPBMLIBTYPE),unixshared) # The libxxx.so link is needed to link the executables. libnetpbm.$(NETPBMLIBSUFFIX): $(SONAME) rm -f $@ $(SYMLINK) $< $@ # The $(SONAME) link is needed only to test the programs without # installing the libraries (in that case, you also need to direct the # dynamic linker to the source directories, e.g. set LD_LIBRARY_PATH). $(SONAME): $(SHLIBOBJECTS) $(LIBOBJECTS_X) $(LD) $(LDSHLIB) -o $@ $(SHLIBOBJECTS) $(LIBOBJECTS_X) \ $(SHLIB_CLIB) $(MATHLIB) $(LADD) endif ifeq ($(NETPBMLIBTYPE),dll) ifeq ($(STATICLIB_TOO),y) $(NETPBMSHLIBPREFIX)netpbm$(DLLVER).dll: $(LIBOBJECTS) $(LIBOBJECTS_X) libnetpbm.$(STATICLIBSUFFIX) else $(NETPBMSHLIBPREFIX)netpbm$(DLLVER).dll: $(LIBOBJECTS) $(LIBOBJECTS_X) endif $(LD) $(LDSHLIB) -Wl,--export-all-symbols \ -Wl,-soname,$(NETPBMSHLIBPREFIX)netpbm$(DLLVER).dll \ -Wl,--out-implib,libnetpbm.dll.a -o $@ $(LDFLAGS) \ $(LIBOBJECTS) $(LIBOBJECTS_X) $(LDLIBS) $(LADD) endif ifeq ($(NETPBMLIBTYPE),dylib) libnetpbm.dylib: libnetpbm.$(MAJ).dylib rm -f $@ $(SYMLINK) $< $@ libnetpbm.$(MAJ).dylib: libnetpbm.$(MAJ).$(MIN).dylib rm -f $@ $(SYMLINK) $< $@ libnetpbm.$(MAJ).$(MIN).dylib: $(LIBOBJECTS) $(LIBOBJECTS_X) $(LD) $(LDSHLIB) -o $@ $(LIBOBJECTS) $(LIBOBJECTS_X) \ -lc $(LADD) endif #-------------------------------------------------------------------------- # The rule for building a static library is below (if needed). This is # tricky because the user can be building the static library as his main # library or in addition to some other kind of main library. In fact, # he may have specified it both as the main library type and an # additional library type. In that case, NETPBMLIBSUFFIX and # STATICLIBSUFFIX are redundant -- we hope they're the same. # # We must not include a rule for static libraries if he doesn't want us # to build any. The library name we come up with might conflict with # the name of the library he actually is building. In fact, in that case # STATICLIB_SUFFIX may just be arbitrary. #----------------------------------------------------------------------------- ifeq ($(NETPBMLIBTYPE),unixstatic) BUILD_STATICLIB = y else ifeq ($(STATICLIB_TOO),y) BUILD_STATICLIB = y else BUILD_STATICLIB = n endif endif ifeq ($(BUILD_STATICLIB),y) libnetpbm.$(STATICLIBSUFFIX): $(LIBOBJECTS) $(LIBOBJECTS_X) -rm -f $@ ar rc $@ $(LIBOBJECTS) $(LIBOBJECTS_X) -$(RANLIB) $@ endif # Note that we create a new compile.h only for the first make after a # make clean. This is good enough. We used to do stamp-date for # every build of "all" from the Netpbm top directory, but nowhere # else, so it was really sloppy. compile.h: $(SRCDIR)/buildtools/stamp-date >$@ || rm $@ util/shhopt.o util/nstring.o: FORCE @if [ ! -d $(dir $@) ] ; then mkdir $(dir $@) ; fi $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \ SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) $(notdir $@) # Install a shared library # .PHONY: install.lib ifeq ($(NETPBMLIBTYPE),unixshared) # install a Unix-style shared library install.lib: $(PKGDIR)/lib cd $(PKGDIR)/lib ; rm -f libnetpbm.$(NETPBMLIBSUFFIX).* ${BSD_INSTALL_DATA} \ $(SONAME) $(PKGDIR)/lib/ endif ifeq ($(NETPBMLIBTYPE),dll) #install a Windows DLL shared library #Note that unlike Unix libraries, a Windows DLL must go into a directory #that is in the PATH, so we use bin/ instead of lib/ install.lib: $(PKGDIR)/bin ( cd $(PKGDIR)/bin ; rm -f $(NETPBMSHLIBPREFIX)netpbm$(DLLVER).dll ) $(INSTALL) -c $(STRIPFLAG) -m $(INSTALL_PERM_LIBD) \ $(NETPBMSHLIBPREFIX)netpbm$(DLLVER).dll $(PKGDIR)/bin/ endif ifeq ($(NETPBMLIBTYPE),dylib) # install a Darwin-style shared library install.lib: $(PKGDIR)/lib cd $(PKGDIR)/lib ; rm -f libnetpbm.*.dylib $(INSTALL) -c -m $(INSTALL_PERM_LIBD) libnetpbm.$(MAJ).$(MIN).dylib \ $(PKGDIR)/lib cd $(PKGDIR)/lib ; \ rm -f libnetpbm.$(MAJ).dylib; \ $(SYMLINK) libnetpbm.$(MAJ).$(MIN).dylib libnetpbm.$(MAJ).dylib endif .PHONY: install.hdr install.hdr: $(INTERFACE_HEADERS:%=%_installhdr) # You need to install the interface header files only if you are going to # compile programs that use the Netpbm libraries. Alternatively, you may # prefer not to "install" them, but just to access the Netpbm source # directory when you compile your programs. %_installhdr: $(PKGDIR)/include ${BSD_INSTALL_DATA} \ $(SRCDIR)/lib/$(@:%_installhdr=%) $(PKGDIR)/include/; .PHONY: install.staticlib install.staticlib: $(PKGDIR)/lib ${BSD_INSTALL_DATA} libnetpbm.$(STATICLIBSUFFIX) \ $(PKGDIR)/lib # Install a shared library stub -- the ".so" file used at link time to # prepare a program for dynamically linking a library at run time .PHONY: install.sharedlibstub install.sharedlibstub: $(PKGDIR)/lib ifeq ($(NETPBMLIBTYPE),unixshared) # install the link-time (.so) links to the runtime libraries cd $(PKGDIR)/lib ; \ rm -f libnetpbm.$(NETPBMLIBSUFFIX); \ $(SYMLINK) $(SONAME) \ libnetpbm.$(NETPBMLIBSUFFIX) endif ifeq ($(NETPBMLIBTYPE),dll) $(INSTALL) -c -m $(INSTALL_PERM_LIBS) libnetpbm.dll.a $(PKGDIR)/link endif ifeq ($(NETPBMLIBTYPE),dylib) cd $(PKGDIR)/link/ ; \ rm -f libnetpbm.dylib; \ $(SYMLINK) ../lib/libnetpbm.$(MAJ).$(MIN).dylib libnetpbm.dylib endif clean: localclean .PHONY: localclean localclean: rm -f compile.h FORCE: