# This Makefile is for building argtable2 with Microsoft Visual C.
# To build a relase version execute
#    NMAKE /f Makefile.nmake
# or for a debug version execute 
#    NMAKE /f Makefile.nmake DEBUG=1

# On Unix and Mac OS X systems the configure script generates a config.h
# file that defines various macros that control which header files are
# included by the source code files on a given platform.
# As the configure script does not work on Windows platforms the config.h
# file is missing and so you must define the appropriate macros manually.
# The macros required for Windows are: STDC_HEADERS, HAVE_STDLIB_H, and
# HAVE_STRING_H. 
# Rather than hand craft a config.h file we just define them here in CFLAGS
# for convenience.
CFLAGS = /W4 /D "WIN32" /D "_MBCS" /D "STDC_HEADERS" /D "HAVE_STDLIB_H" /D "HAVE_STRING_H" /nologo 

!IF "$(DEBUG)" == "1"
CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /MLd /RTC1 /ZI
!ELSE
CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 /ML /GS /Zi
!ENDIF
  
all: argtable2.lib argtable2.dll

OBJS = argtable2.obj arg_dbl.obj arg_end.obj arg_file.obj arg_int.obj arg_lit.obj arg_rem.obj arg_str.obj getopt.obj getopt1.obj

$(OBJS): argtable2.h getopt.h

argtable2.lib: $(OBJS)
	LIB /OUT:$@ $**

argtable2.dll: $(OBJS)
	link /DLL /OUT:$@ $** /IMPLIB:impargtable2.lib
    
clean:
	del *.exe *.lib *.obj *.idb *.pdb
