#
# Nmake file for libmseed - MS Visual C/C++
# Use 'nmake -f Makefile.win'

NODEBUG=1

INCS = /I.
OPTS = /O2 /D_CRT_SECURE_NO_WARNINGS
LM_LIB = libmseed.lib
LM_DLL = libmseed.dll
LM_DEF = libmseed.def

OBJS =  fileutils.obj   \
        genutils.obj    \
        msio.obj        \
        lookup.obj      \
        yyjson.obj      \
        msrutils.obj    \
        extraheaders.obj\
        pack.obj        \
        packdata.obj    \
        tracelist.obj   \
        gmtime64.obj    \
        crc32c.obj      \
        parseutils.obj  \
        unpack.obj      \
        unpackdata.obj  \
        selection.obj   \
        logging.obj

all: lib

lib: $(OBJS)
	link.exe /lib /nologo /OUT:$(LM_LIB) $(OBJS)

dll: $(OBJS)
	link.exe /dll /nologo /OUT:$(LM_DLL) $(OBJS)

.c.obj:
	$(CC) /nologo $(CFLAGS) $(INCS) $(OPTS) /c $<

# Run test suite
test: lib
	pushd $@ && $(MAKE) /NOLOGO /f Makefile.win /$(MAKEFLAGS) & popd

# Clean-up directives
clean:
	-del a.out core *.o *.obj *% *~ libmseed.exp $(LM_LIB) $(LM_DLL)
	@pushd test && $(MAKE) /NOLOGO /f Makefile.win $@ /$(MAKEFLAGS) & popd
