# # Nulib2 # Copyright (C) 2000-2007 by Andy McFadden, All Rights Reserved. # This is free software; you can redistribute it and/or modify it under the # terms of the BSD License, see the file COPYING. # # Makefile for nulib2 stuff (should work with non-GNU make). # # You can use: # make (builds nulib2 and checks for libnufx.a) # make shared (builds nulib2 and checks for libnufx.so) # # This will try to link against the library in $(NUFXSRCDIR) first, then # look for a copy in the standard system install location (usually # /usr/local/lib). # # Note that this really wants to find $(NUFXLIB) for dependency checking. # If you're building against a copy in /usr/local/lib, just put a '#' in # front of the "NUFXLIB" line below. # # set this to where the NuFX library and ".h" file live NUFXSRCDIR = ../nufxlib NUFXLIB = $(NUFXSRCDIR)/$(LIB_PRODUCT) # NuLib2 install location. The man page will go into $(mandir)/man1. prefix = @prefix@ exec_prefix = @exec_prefix@ includedir = @includedir@ libdir = @libdir@ bindir = @bindir@ mandir = @mandir@ srcdir = @srcdir@ SHELL = @SHELL@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ CC = @CC@ #OPT = @CFLAGS@ -DNDEBUG OPT = @CFLAGS@ #OPT = @CFLAGS@ -DDEBUG_MSGS #OPT = @CFLAGS@ -DDEBUG_VERBOSE GCC_FLAGS = -Wall -Wwrite-strings -Wstrict-prototypes -Wpointer-arith -Wshadow CFLAGS = @BUILD_FLAGS@ -I. -I$(NUFXSRCDIR) -I$(includedir) @DEFS@ SRCS = Add.c ArcUtils.c Binary2.c Delete.c Extract.c Filename.c \ List.c Main.c MiscStuff.c MiscUtils.c State.c SysUtils.c OBJS = Add.o ArcUtils.o Binary2.o Delete.o Extract.o Filename.o \ List.o Main.o MiscStuff.o MiscUtils.o State.o SysUtils.o PRODUCT = nulib2 # this is used for dependency checking LIB_PRODUCT = libnufx.a # # Build stuff # all: $(PRODUCT) @true install: $(PRODUCT) $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) $(PRODUCT) $(DESTDIR)$(bindir) $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1 $(INSTALL_DATA) nulib2.1 $(DESTDIR)$(mandir)/man1/ install-shared: LIB_PRODUCT="libnufx.so" $(MAKE) -e install # Link against the shared version of libnufx. This is only needed so # the dependency checking does the right thing during development. Note # we probably don't need to link against all of LIBS, especially -lz -lbz2, # but there's little harm in doing so. shared:: LIB_PRODUCT="libnufx.so" $(MAKE) -e $(PRODUCT): $(OBJS) $(NUFXLIB) $(CC) $(LDFLAGS) -o $@ $(OBJS) -L$(NUFXSRCDIR) -L$(libdir) -lnufx @LIBS@ clean: -rm -f *.o core -rm -f $(PRODUCT) tags:: ctags -R --totals * $(NUFXSRCDIR)/* @#ctags *.[ch] $(NUFXSRCDIR)/*.[ch] distclean: clean -rm -f Makefile Makefile.bak -rm -f config.log config.cache config.status config.h -rm -f tags -rm -f nulib2-@host_alias@ nulib2-@host_alias@.tar.Z # Copy all of the binaries into a directory and tar them up for distribution. # All binaries except "nulib2" are stripped to reduce their size. distbin: $(PRODUCT) @ \ builddir="nulib2-@host_alias@"; \ samples=$(NUFXSRCDIR)/samples; \ echo "building $$builddir.tar.Z"; \ rm -rf $$builddir; \ mkdir -p $$builddir; \ cp -p $(PRODUCT) nulib2.1 README.txt COPYING $$samples/README-S.txt \ $$samples/exerciser $$samples/imgconv $$samples/launder \ $$samples/test-basic $$samples/test-extract \ $$samples/test-simple \ $$builddir; \ strip $$builddir/$(PRODUCT) \ $$builddir/exerciser $$builddir/imgconv $$builddir/launder \ $$builddir/test-basic $$builddir/test-extract \ $$builddir/test-simple; \ tar -cf - $$builddir | compress > $$builddir.tar.Z; \ rm -rf $$builddir # Make a tarfile with a backup of the essential files. We include "Makefile" # so that we can do a "make distclean" during packaging. baktar: @tar cvf nulib2.tar *.txt COPYING INSTALL nulib2.1 configure *.in Makefile \ Makefile.msc install-sh config.guess config.sub mkinstalldirs *.[ch] @gzip -9 nulib2.tar @mv -i nulib2.tar.gz /home/fadden/BAK/ # dependency info COMMON_HDRS = NuLib2.h SysDefs.h State.h MiscStuff.h config.h \ $(NUFXSRCDIR)/NufxLib.h Add.o: Add.c $(COMMON_HDRS) ArcUtils.o: ArcUtils.c $(COMMON_HDRS) Binary2.o: Binary2.c $(COMMON_HDRS) Delete.o: Delete.c $(COMMON_HDRS) Extract.o: Extract.c $(COMMON_HDRS) Filename.o: Filename.c $(COMMON_HDRS) List.o: List.c $(COMMON_HDRS) Main.o: Main.c $(COMMON_HDRS) MiscStuff.o: MiscStuff.c $(COMMON_HDRS) MiscUtils.o: MiscUtils.c $(COMMON_HDRS) State.o: State.c $(COMMON_HDRS) SysUtils.o: SysUtils.c $(COMMON_HDRS)