mirror of
https://github.com/fadden/nulib2.git
synced 2024-10-31 11:08:35 +00:00
113 lines
2.9 KiB
Makefile
113 lines
2.9 KiB
Makefile
#
|
|
# Makefile for nufxlib stuff (should work with non-GNU "make").
|
|
#
|
|
# You can use:
|
|
# make (builds library and sample applications)
|
|
# make shared (builds shared library if you're using GNU ld or similar)
|
|
#
|
|
|
|
# NufxLib install location.
|
|
prefix = @prefix@
|
|
exec_prefix = @exec_prefix@
|
|
includedir = @includedir@
|
|
libdir = @libdir@
|
|
srcdir = @srcdir@
|
|
|
|
SHELL = @SHELL@
|
|
INSTALL = @INSTALL@
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
INSTALL_DATA = @INSTALL_DATA@
|
|
CC = @CC@
|
|
AR = ar rcv
|
|
#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. @DEFS@
|
|
|
|
SRCS = Archive.c ArchiveIO.c Compress.c Crc16.c Debug.c Deferred.c \
|
|
Entry.c Expand.c FileIO.c Funnel.c Lzc.c Lzw.c MiscStuff.c \
|
|
MiscUtils.c Record.c SourceSink.c Squeeze.c Thread.c Value.c \
|
|
Version.c
|
|
OBJS = Archive.o ArchiveIO.o Compress.o Crc16.o Debug.o Deferred.o \
|
|
Entry.o Expand.o FileIO.o Funnel.o Lzc.o Lzw.o MiscStuff.o \
|
|
MiscUtils.o Record.o SourceSink.o Squeeze.o Thread.o Value.o \
|
|
Version.o
|
|
|
|
STATIC_PRODUCT = libnufx.a
|
|
SHARED_PRODUCT = libnufx.so
|
|
PRODUCT = $(STATIC_PRODUCT)
|
|
|
|
|
|
#
|
|
# Build stuff
|
|
#
|
|
|
|
all: $(PRODUCT) samples
|
|
@true
|
|
|
|
install: $(STATIC_PRODUCT)
|
|
$(srcdir)/mkinstalldirs $(libdir)
|
|
$(INSTALL_DATA) $(STATIC_PRODUCT) $(libdir)
|
|
$(srcdir)/mkinstalldirs $(includedir)
|
|
$(INSTALL_DATA) NufxLib.h $(includedir)
|
|
|
|
install-shared: $(SHARED_PRODUCT)
|
|
$(srcdir)/mkinstalldirs $(libdir)
|
|
$(INSTALL_DATA) $(SHARED_PRODUCT) $(libdir)
|
|
$(srcdir)/mkinstalldirs $(includedir)
|
|
$(INSTALL_DATA) NufxLib.h $(includedir)
|
|
|
|
samples::
|
|
@echo "Building samples..."
|
|
@(cd samples; set +e; unset CFLAGS OBJS; set -e; \
|
|
@SET_MAKE@ LIB_PRODUCT="../$(PRODUCT)" $(MAKE))
|
|
|
|
shared::
|
|
PRODUCT="$(SHARED_PRODUCT)" $(MAKE) -e
|
|
|
|
$(STATIC_PRODUCT): $(OBJS)
|
|
-rm -f $(SHARED_PRODUCT)
|
|
$(AR) $@ $(OBJS)
|
|
@RANLIB@ $@
|
|
|
|
$(SHARED_PRODUCT): $(OBJS)
|
|
-rm -f $(STATIC_PRODUCT)
|
|
$(CC) @SHARE_FLAGS@ -o $@ $(OBJS)
|
|
|
|
# the build date is approximate, the build flags are accurate
|
|
Version.c: Version.c.in Makefile
|
|
(sed -e "s/BUILT/`date`/" -e "s/OPTFLAGS/$(OPT)/" < Version.c.in > Version.c)
|
|
|
|
clean:
|
|
(cd samples; make clean)
|
|
-rm -f *.o core
|
|
-rm -f $(SHARED_PRODUCT) $(STATIC_PRODUCT)
|
|
|
|
# build tags; assumes fancy GNU tag generation
|
|
tags::
|
|
@ctags -R --totals *
|
|
@#ctags *.[ch]
|
|
|
|
distclean: clean
|
|
(cd samples; make distclean)
|
|
-rm -f Version.c
|
|
-rm -f Makefile Makefile.bak
|
|
-rm -f config.log config.cache config.status config.h
|
|
-rm -f tags
|
|
|
|
baktar:
|
|
@tar cvf nufxlib.tar *.txt COPYING-LIB INSTALL configure *.in Makefile \
|
|
Makefile.msc install-sh config.guess config.sub mkinstalldirs *.[ch] \
|
|
samples/*.txt samples/Makefile* samples/*.[ch]
|
|
@gzip -9 nufxlib.tar
|
|
@mv -i nufxlib.tar.gz /home/fadden/BAK/
|
|
|
|
depend:
|
|
makedepend -- $(CFLAGS) -I/usr/local/include -- $(SRCS)
|
|
@(cd samples; unset CFLAGS OBJS; @SET_MAKE@ $(MAKE) depend)
|
|
|
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
|
|