##############################################################################
#           Makefile for use by API developers                               #
#                                                                            #
#  NOTE: vcvars32.bat must be run before attempting to compile the API       #
#  examples. Please see the API documentation for information.               #
#                                                                            #
##############################################################################

#
# If the location of the Alias libraries and header files are
# different from $ALIAS_LOCATION, set it here.
#
ALIAS_LOCATION=C:\Program Files\Autodesk\Alias2016

CPPEXAMPLES = deleteBlindData.exe deleteNodeBlindData.exe

EXAMPLES = $(CPPEXAMPLES)

CC = cl.exe
CPLUSPLUS = cl.exe
LINK = link.exe
INCLUDES = /I. /I"$(ALIAS_LOCATION)\ODS\Common\include"

EXTRA_LFLAGS = /LIBPATH:"$(ALIAS_LOCATION)\Lib"
EXTRA_CFLAGS = 

LFLAGS = /nologo /SUBSYSTEM:CONSOLE /NODEFAULTLIB:LIBC.LIB $(EXTRA_LFLAGS) /machine:I38
#
# Required libraries. 
#
LIBS = libalias_api.lib

STD = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib \
     advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
     odbc32.lib odbccp32.lib comctl32.lib netapi32.lib \
     version.lib ws2_32.lib

CLIBS = $(LIBS) $(STD)

#
# Some code is conditionally compiled because it produces a lot of output.
# (see AlPrint.cpp for example) Uncomment the following line if you would
# like to see all the output.
#
# COPIOUS_OUTPUT = -DCOPIOUS_OUTPUT

CFLAGS = /nologo /MD $(INCLUDES) $(COPIOUS_OUTPUT) $(EXTRA_CFLAGS)
CPLUSPLUSFLAGS = $(CFLAGS)

#
# Rules for building.
#
.SUFFIXES: .c .c++ .obj .cpp

.cpp.obj:
	$(CPLUSPLUS) -c $(CPLUSPLUSFLAGS) $*.cpp

.c.obj:
	$(CC) -c $(CFLAGS) $*.c

#
# Build all the examples.
#
default: $(EXAMPLES)

#
# Copy all the source files for the examples.
#
copy:
	copy "$(ALIAS_LOCATION)\ODS\OpenModel\utilities\*.cpp" .
	copy "$(ALIAS_LOCATION)\ODS\OpenModel\utilities\*.h" .

#
# Clean up.
#
clean:
	del *.obj $(EXAMPLES)

#
# Rules for building the C++ executables.
#
deleteBlindData.exe:			deleteBlindData.obj
	$(LINK) $(LFLAGS) /out:$@ deleteBlindData.obj $(CLIBS)

deleteNodeBlindData.exe:			deleteNodeBlindData.obj WalkTree.obj
	$(LINK) $(LFLAGS) /out:$@ deleteNodeBlindData.obj WalkTree.obj $(CLIBS)
