Tweak Win32 build

Use an export definition file to avoid generation of unnecessary
output by the linker.

Deleted some obsolete files.
This commit is contained in:
Andy McFadden 2014-10-30 11:40:14 -07:00
parent c4bed18e6b
commit fbe63902ba
5 changed files with 80 additions and 286 deletions

View File

@ -2,7 +2,8 @@
# as a static lib and as a DLL, and builds all samples. The test-basic
# sample is built twice, once with the static lib, and once with the DLL.
#
# Tested with VS 2013 Pro.
# Tested with VS 2013 Pro. From the "VS2013 x86 Native Tools Command
# Prompt", run "nmake -f makefile.msc".
#
# If you're including zlib support, place copies of zlib.h, zconf.h,
# and the zlib library in this directory.
@ -35,8 +36,9 @@ AR = lib
# built. Defining NUFXLIB_EXPORTS enables the __declspec(dllexport)
# macros that are required for creating the DLL.
OPTFLAGS = -Ox -Oy-
CFLAGS = -nologo -MD -W3 $(OPTFLAGS) -Zi -Fd"nufxlib" \
-DOPTFLAGSTR="\"$(OPTFLAGS)\"" -DNUFXLIB_EXPORTS
CFLAGS = -nologo -MD -W3 $(OPTFLAGS) -Zi -Fd"nufxlib"
LIB_CFLAGS = -DOPTFLAGSTR="\"$(OPTFLAGS)\"" #-DNUFXLIB_EXPORTS
# Warning suppression flags
WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
@ -84,7 +86,8 @@ $(STATICLIB): $(OBJS)
$(IMPLIB): $(SHAREDLIB)
$(SHAREDLIB): $(OBJS)
$(LD) $(LDFLAGS) -dll -implib:$(IMPLIB) -out:$@ $(OBJS)
$(LD) $(LDFLAGS) -dll -def:nufxlib.def -implib:$(IMPLIB) -out:$@ \
$(OBJS)
exerciser.exe: Exerciser.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ Exerciser.obj $(STATICLIB)
@ -112,7 +115,7 @@ test-twirl.exe: TestTwirl.obj $(STATICLIB)
# generic rules
{$(TOP)}.c.obj:
$(CC) -c $(WFLAGS) $(CFLAGS) $<
$(CC) -c $(WFLAGS) $(CFLAGS) $(LIB_CFLAGS) $<
{$(TOP)/samples}.c.obj:
$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<

67
nufxlib/nufxlib.def Normal file
View File

@ -0,0 +1,67 @@
; NufxLib library exported symbols
;
; This is redundant with the __declspec(dllexport) declarations enabled
; with the NUFXLIB_EXPORTS symbol. If we're just building a DLL, there's
; no need for this file. However, the objects we're building are used for
; both the static library and the dynamic library, and we don't want to
; have exports in the static library. If we do, the linker will create
; .lib and .exp files for every executable we link against it. This is
; mostly harmless, but a tad messy. I don't expect the interface to change,
; so there's not much of a maintenance burden here.
;
EXPORTS
NuAbort
NuAddFile
NuAddRecord
NuAddThread
NuClose
NuContents
NuCreateDataSinkForBuffer
NuCreateDataSinkForFP
NuCreateDataSinkForFile
NuCreateDataSourceForBuffer
NuCreateDataSourceForFP
NuCreateDataSourceForFile
NuDataSinkGetOutCount
NuDataSourceSetRawCrc
NuDebugDumpArchive
NuDelete
NuDeleteRecord
NuDeleteThread
NuExtract
NuExtractRecord
NuExtractThread
NuFlush
NuFreeDataSink
NuFreeDataSource
NuGetAttr
NuGetExtraData
NuGetMasterHeader
NuGetRecord
NuGetRecordIdxByName
NuGetRecordIdxByPosition
NuGetValue
NuGetVersion
NuIsPresizedThreadID
NuOpenRO
NuOpenRW
NuRecordCopyAttr
NuRecordCopyThreads
NuRecordGetNumThreads
NuRename
NuSetErrorHandler
NuSetErrorMessageHandler
NuSetExtraData
NuSetGlobalErrorMessageHandler
NuSetOutputPathnameFilter
NuSetProgressUpdater
NuSetRecordAttr
NuSetSelectionFilter
NuSetValue
NuStrError
NuStreamOpenRO
NuTest
NuTestFeature
NuTestRecord
NuThreadGetByIdx
NuUpdatePresizedThread

View File

@ -1,6 +1,7 @@
# Makefile for NuLib2 using Microsoft Visual C++.
#
# Tested with VS 2013 Pro.
# Tested with VS 2013 Pro. From the "VS2013 x86 Native Tools Command
# Prompt", run "nmake -f makefile.msc".
#
# If you're including zlib support, place a copy of the zlib
# library in this directory.
@ -8,6 +9,7 @@
TOP = .
NUFXSRCDIR = ..\nufxlib
NUFXLIB = $(NUFXSRCDIR)\nufxlib2.lib
PRODUCT = nulib2.exe
@ -50,8 +52,8 @@ OBJS = Add.obj ArcUtils.obj Binary2.obj Delete.obj Extract.obj Filename.obj \
# build targets
all: $(PRODUCT)
$(PRODUCT): $(OBJS) $(NUFXSRCDIR)\nufxlib2.lib
$(LD) $(LDFLAGS) -out:$@ $(OBJS) $(NUFXSRCDIR)\nufxlib2.lib
$(PRODUCT): $(OBJS) $(NUFXLIB)
$(LD) $(LDFLAGS) -out:$@ $(OBJS) $(NUFXLIB)
clean:
-del *.obj *.pdb *.exp

View File

@ -1,15 +0,0 @@
NufxLib/NuLib2 README for SourceForge
The project is "nulib2", and can be found at nulib2.sourceforge.net.
There are two CVS modules, "nulib2" and "nufxlib-0". You need to
"cvs checkout nulib2 nufxlib-0" to get both.
In a "normal" source distribution, the version number on the nufxlib
directory is changed to reflect the current version. This is done
automatically with distribution scripts. These same scripts also pack
up the Win32 version of the application. A copy of these scripts can
be found in dist-scripts.shar.
Among other things, the scripts update the version number on the
directories and in the Makefile, so the correct thing is linked against.

View File

@ -1,263 +0,0 @@
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2003-03-18 19:02 PST by <fadden@shiny>.
# Source directory was `/home/fadden/Stage'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 908 -rwxr-xr-x prep.sh
# 477 -rwxr-xr-x post.sh
# 682 -rwxr-xr-x mkzip
# 4 -rw-r--r-- VERSION
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh01355; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= prep.sh ==============
if test -f 'prep.sh' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'prep.sh' '(file already exists)'
else
$echo 'x -' extracting 'prep.sh' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'prep.sh' &&
#!/bin/sh
set -e
X
version=`cat VERSION`
echo "Preparing for version=$version."
X
libdir=nufxlib-$version
appdir=nulib2-$version
X
if [ -d $libdir ]; then
X echo "libdir exists, trashing"
X read x
X rm -rf $libdir
fi
mkdir $libdir
cd $libdir
zcat $HOME/BAK/nufxlib.tar.gz | tar xvf -
make distclean
cd ..
X
if [ -d $appdir ]; then
X echo "appdir exists, trashing"
X read x
X rm -rf $appdir
fi
mkdir $appdir
cd $appdir
zcat $HOME/BAK/nulib2.tar.gz | tar xvf -
make distclean
rm README-Win32.txt
X
sed -e "s/VERSION..= 0/VERSION = $version/" < Makefile.in > Makefile.new
set +e ; diff Makefile.in Makefile.new ; set -e
mv -f Makefile.new Makefile.in
X
sed -e "s/VERSION=0/VERSION=$version/" < Makefile.msc > Makefile.new
set +e ; diff Makefile.msc Makefile.new ; set -e
mv -f Makefile.new Makefile.msc
X
cd ..
X
echo IMPORTANT: you did "make baktar" first, right?
echo IMPORTANT: put the release into ChangeLog.txt
X
Xexit 0
SHAR_EOF
(set 20 03 03 18 19 02 04 'prep.sh'; eval "$shar_touch") &&
chmod 0755 'prep.sh' ||
$echo 'restore of' 'prep.sh' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'prep.sh:' 'MD5 check failed'
e90f77fcaef20dc96dd521257744763c prep.sh
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'prep.sh'`"
test 908 -eq "$shar_count" ||
$echo 'prep.sh:' 'original size' '908,' 'current size' "$shar_count!"
fi
fi
# ============= post.sh ==============
if test -f 'post.sh' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'post.sh' '(file already exists)'
else
$echo 'x -' extracting 'post.sh' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'post.sh' &&
#!/bin/sh
set -e
X
version=`cat VERSION`
echo "Staging with version=$version."
X
libdir=nufxlib-$version
appdir=nulib2-$version
X
set -x
#rm -f $appdir/MiscStuff.c
#cp $libdir/MiscStuff.c $appdir
#rm -f $appdir/MiscStuff.h
#cp $libdir/MiscStuff.h $appdir
#rm -f $appdir/SunOS4.h
#cp $libdir/SunOS4.h $appdir
X
tar cf nulibdist-$version.tar $libdir $appdir
gzip -9 nulibdist-$version.tar
set +x
X
echo ""
echo "IMPORTANT: did you put the release into ChangeLog.txt?"
echo ""
X
Xexit 0
SHAR_EOF
(set 20 02 10 11 13 56 59 'post.sh'; eval "$shar_touch") &&
chmod 0755 'post.sh' ||
$echo 'restore of' 'post.sh' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'post.sh:' 'MD5 check failed'
f662165f13315e3484e1e182d0e4afcb post.sh
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'post.sh'`"
test 477 -eq "$shar_count" ||
$echo 'post.sh:' 'original size' '477,' 'current size' "$shar_count!"
fi
fi
# ============= mkzip ==============
if test -f 'mkzip' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'mkzip' '(file already exists)'
else
$echo 'x -' extracting 'mkzip' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'mkzip' &&
#!/bin/sh
set -e
set -x
X
version=`cat VERSION`
echo "Preparing for version=$version."
X
archive=nulib2_${version}_win32.zip
basedir=/dosc/Src
#basedir=$HOME/tmp
mansrc=$HOME/Nulib2/nulib2/nulib2.1
manout=$HOME/nulib2.man
X
rm -f $archive
rm -f $manout
X
zip -9j $archive $HOME/Nulib2/nulib2/README-Win32.txt
nroff -man $mansrc | col -b > $manout
zip -9jl $archive $manout
rm $manout
zip -9j $archive $basedir/nulib2-$version/nulib2.exe
zip -9jl $archive $basedir/nufxlib-$version/samples/README-S.txt
zip -9j $archive \
X $basedir/nufxlib-$version/samples/exerciser.exe \
X $basedir/nufxlib-$version/samples/imgconv.exe \
X $basedir/nufxlib-$version/samples/launder.exe
X
Xexit 0
X
SHAR_EOF
(set 20 03 03 18 18 14 44 'mkzip'; eval "$shar_touch") &&
chmod 0755 'mkzip' ||
$echo 'restore of' 'mkzip' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'mkzip:' 'MD5 check failed'
a70595bee88da7257676c10e42784e76 mkzip
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'mkzip'`"
test 682 -eq "$shar_count" ||
$echo 'mkzip:' 'original size' '682,' 'current size' "$shar_count!"
fi
fi
# ============= VERSION ==============
if test -f 'VERSION' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'VERSION' '(file already exists)'
else
$echo 'x -' extracting 'VERSION' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'VERSION' &&
200
SHAR_EOF
(set 20 03 03 18 17 15 52 'VERSION'; eval "$shar_touch") &&
chmod 0644 'VERSION' ||
$echo 'restore of' 'VERSION' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'VERSION:' 'MD5 check failed'
c1ba58b05f6245f221ad65391fa6690b VERSION
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'VERSION'`"
test 4 -eq "$shar_count" ||
$echo 'VERSION:' 'original size' '4,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh01355
exit 0