#
# $Id: //devel/tools/main/rfc868time/makefile#6 $
#
# written by :	Stephen J. Friedl
#		Software Consultant
#		steve@unixwiz.net
#
#	This is the makefile for the RC868 time service; it requires
#	*GNU* make, not Microsoft's make.
#

# ------------------------------------------------------------------------
# SET C COMPILER AND FLAGS
#
#	UNIX typically uses "cc" or "gcc" for the C compiler, and on
#	NT it works best with "cl". The compiler flags are different
#	too, so they are set in one place.
#
#	-nologo		suppress the Microsoft copyright message
#
#	-WX		warnings are treated as errors
#
#	-W3		lots of warnings
#
#	-MD		link with use MSVCRT.DLL
#
#	-DWIN32_LEAN_AND_MEAN	skips a LOT of stuff in <windows.h>
#

CDEFS = -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE

# /Gz = __stdcall
# /GS - enable stack overflow detection
# /W4 = more errors
# /WX = warnings are treated as errors
# /MT = Link with LIBCMT.LIB

CFLAGS  = /Gz /GS /WX /W3 /MT $(CDEFS)

# Linker options:
#
# /SafeSEH - Exception Handling Protection
# /NXCOMPAT enables Data Execution Prevention
# /DYNAMICBASE enables ASLR (Address Space Layout Randomization)

LFLAGS = /SafeSEH /NXCOMPAT /DYNAMICBASE

CC=cl -nologo
CPP=cl -nologo

# ------------------------------------------------------------------------
# LIST OF ALL TARGETS
#
#
ALL = rfc868time.exe

CLEAN	= *.obj *.pch
CLOBBER = $(ALL)

all : $(ALL)

RFC868TIME = rfc868time.obj service.obj odprintf.obj

rfc868time.exe : $(RFC868TIME)
	link /nologo /out:$@ $(LFLAGS) $(RFC868TIME) advapi32.lib Ws2_32.lib kernel32.lib

clean :
	-del $(CLEAN)

clobber : clean
	-del $(CLOBBER)

%.obj : %.cpp
	$(CPP) -c $(CFLAGS) $*.cpp

SOURCE= makefile \
	nmakefile \
	defs.h \
	odprintf.cpp rfc868time.cpp service.cpp

rfc868time-source.zip : $(SOURCE)
	pkzipc -add $@ $(SOURCE)

ifdef PCLINTDIR

LINTFLAGS  = -i$(PCLINTDIR)/lnt
LINTFLAGS += -D_MT
LINTFLAGS += -background
LINTFLAGS += local.lnt
LINTSRC = $(patsubst %.obj,%.cpp,$(RFC868TIME))

lint :
	$(strip lint-nt $(LINTFLAGS) $(CDEFS) $(LINTSRC))
endif

# just for S. Friedl's developmenthere
web : rfc868time.exe rfc868time-source.zip
	perl ../putwebtool.p --tool=rfc868time --verquery=-version
