nulib2/nulib2/Makefile.msc

81 lines
2.2 KiB
Makefile

# Makefile for NuLib2 using Microsoft Visual C++.
#
# 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.
#
TOP = .
NUFXSRCDIR = ..\nufxlib
NUFXLIB = $(NUFXSRCDIR)\nufxlib2.lib
PRODUCT = nulib2.exe
CC = cl
LD = link
# C compiler flags
# -Ox: full optimization
# -Oy-: disable frame pointer omission (for easier debugging)
# -MD: create a multithreaded DLL using MSVCRT.lib; alternatively,
# use -MDd to create a debug executable with MSVCRTD.lib
# -nologo: suppress display of copyright banner
# -W3: set warning level to 3 (all production-level warnings)
# -Zi: generate a PDB file with full debugging info
CFLAGS = -nologo -MD -W3 -Ox -Oy- -Zi "-I$(NUFXSRCDIR)"
# Warning suppression flags
WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
# Linker flags
# -debug: creates debugging info for EXE or DLL in PDB file
# -nologo: suppress display of copyright banner
# -opt:ref: eliminates unreferenced functions and data (default for non-debug
# builds, but we've enabled debug info)
LDFLAGS = -nologo -debug -opt:ref
ZLIB=1
!ifdef ZLIB
# enable deflate support; requires zlib
LDFLAGS = $(LDFLAGS) zlib.lib
!endif
# object files
OBJS = Add.obj ArcUtils.obj Binary2.obj Delete.obj Extract.obj Filename.obj \
List.obj Main.obj MiscStuff.obj MiscUtils.obj State.obj SysUtils.obj
# build targets
all: $(PRODUCT)
$(PRODUCT): $(OBJS) $(NUFXLIB)
$(LD) $(LDFLAGS) -out:$@ $(OBJS) $(NUFXLIB)
clean:
-del *.obj *.pdb *.exp
-del $(PRODUCT)
# generic rules
.c.obj:
$(CC) -c $(WFLAGS) $(CFLAGS) $<
# dependency info
COMMON_HDRS = NuLib2.h $(NUFXSRCDIR)\NufxLib.h SysDefs.h State.h MiscStuff.h
Add.obj: Add.c $(COMMON_HDRS)
ArcUtils.obj: ArcUtils.c $(COMMON_HDRS)
Binary2.obj: Binary2.c $(COMMON_HDRS)
Delete.obj: Delete.c $(COMMON_HDRS)
Extract.obj: Extract.c $(COMMON_HDRS)
Filename.obj: Filename.c $(COMMON_HDRS)
List.obj: List.c $(COMMON_HDRS)
Main.obj: Main.c $(COMMON_HDRS)
MiscStuff.obj: MiscStuff.c $(COMMON_HDRS)
MiscUtils.obj: MiscUtils.c $(COMMON_HDRS)
State.obj: State.c $(COMMON_HDRS)
SysUtils.obj: SysUtils.c $(COMMON_HDRS)