2000-05-23 01:55:31 +00:00
|
|
|
#
|
2002-10-11 20:13:25 +00:00
|
|
|
# Nulib2
|
2007-02-19 23:11:55 +00:00
|
|
|
# Copyright (C) 2000-2007 by Andy McFadden, All Rights Reserved.
|
2002-10-11 20:13:25 +00:00
|
|
|
# This is free software; you can redistribute it and/or modify it under the
|
2007-02-19 23:11:55 +00:00
|
|
|
# terms of the BSD License, see the file COPYING.
|
2002-10-11 20:13:25 +00:00
|
|
|
#
|
2000-05-23 01:55:31 +00:00
|
|
|
# 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
|
2014-10-28 17:50:13 +00:00
|
|
|
NUFXSRCDIR = ../nufxlib
|
2000-05-23 01:55:31 +00:00
|
|
|
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@
|
|
|
|
|
2002-10-09 00:15:24 +00:00
|
|
|
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
|
2000-05-23 01:55:31 +00:00
|
|
|
|
|
|
|
PRODUCT = nulib2
|
|
|
|
|
|
|
|
# this is used for dependency checking
|
|
|
|
LIB_PRODUCT = libnufx.a
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build stuff
|
|
|
|
#
|
|
|
|
|
|
|
|
all: $(PRODUCT)
|
|
|
|
@true
|
|
|
|
|
|
|
|
install: $(PRODUCT)
|
2019-05-04 21:02:54 +00:00
|
|
|
$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
|
|
|
|
$(INSTALL_PROGRAM) $(PRODUCT) $(DESTDIR)$(bindir)
|
|
|
|
$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1
|
|
|
|
$(INSTALL_DATA) nulib2.1 $(DESTDIR)$(mandir)/man1/
|
2000-05-23 01:55:31 +00:00
|
|
|
|
|
|
|
install-shared:
|
|
|
|
LIB_PRODUCT="libnufx.so" $(MAKE) -e install
|
|
|
|
|
|
|
|
# Link against the shared version of libnufx. This is only needed so
|
2002-10-09 23:12:33 +00:00
|
|
|
# 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.
|
2000-05-23 01:55:31 +00:00
|
|
|
shared::
|
|
|
|
LIB_PRODUCT="libnufx.so" $(MAKE) -e
|
|
|
|
|
|
|
|
$(PRODUCT): $(OBJS) $(NUFXLIB)
|
2019-05-04 21:04:46 +00:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $(OBJS) -L$(NUFXSRCDIR) -L$(libdir) -lnufx @LIBS@
|
2000-05-23 01:55:31 +00:00
|
|
|
|
|
|
|
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
|
2014-10-28 17:50:13 +00:00
|
|
|
-rm -f nulib2-@host_alias@ nulib2-@host_alias@.tar.Z
|
2000-05-23 01:55:31 +00:00
|
|
|
|
|
|
|
# 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)
|
|
|
|
@ \
|
2014-10-28 17:50:13 +00:00
|
|
|
builddir="nulib2-@host_alias@"; \
|
2000-05-23 01:55:31 +00:00
|
|
|
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
|
|
|
|
|
2006-02-19 01:55:02 +00:00
|
|
|
# Make a tarfile with a backup of the essential files. We include "Makefile"
|
|
|
|
# so that we can do a "make distclean" during packaging.
|
2000-05-23 01:55:31 +00:00
|
|
|
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/
|
|
|
|
|
Distinguish Unicode and Mac OS Roman strings
NufxLib has historically made no effort to distinguish between
the character set used for filenames on the local disk, and for
filenames stored within the archive. Now all Unicode filename
strings use the UNICHAR type and have "UNI" in the name, and all
Mac OS Roman strings have "MOR" in the name. (The naming
convention makes it obvious when you're assigning the wrong thing;
on Linux both formats are char*, so the compiler won't tell you
if you get it wrong.)
The distinction is necessary because filesystems generally support
Unicode these days, but on Windows you need to use a separate
set of wide-character file I/O functions. (On Linux it all works
with "narrow" strings, and the UTF-8 encoding is interpreted by
applications.) The character set used for NuFX archive filenames
is MOR, matching what GS/OS + HFS supported, and we want to be able
to convert back and forth between MOR and a Unicode representation.
This change updates the various character types and string names,
adds conversion functions, and updates NuLib2 for proper execution
on Linux. It does not include the (probably extensive) changes
required for Windows UTF-16 support. Instead, the conversion
functions are no-ops, which should result in NuLib2 for Windows
continuing to behave in the same slightly broken way.
This adds "test-names", which exercises Unicode filenames a bit.
It will not pass on Win32.
Also, tweaked the Linux makefiles to have explicit dependencies,
rather than empty space and an expectation that "makedepend" exists.
Also, minor source code cleanups.
While this probably doesn't affect binary compatibility -- it's
mainly a matter of naming and string interpretation -- there's
enough going on that it should be considered an API revision, so
this updates the version to 3.0.0.
2014-12-24 19:14:32 +00:00
|
|
|
# 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)
|
2000-05-23 01:55:31 +00:00
|
|
|
|