#             PTC             File
#    Date   Version   Author  Vers  Comment
# --------- -------  -------- ----- -------------------------------------------
# 10-May-98 I-01-07  CHI        @@1 added version header
# 04-JUN-98 I-01-10  KMG        @@2 added mpr.lib
# 04-Sep-98 I-01-18  CHI        @@3 rm obsolete defn
# 09-Mar-99 I-03-03  ksi        @@4 Link with both libc and libcmt
# 15-Mar-99 I-03-04  ksi        @@5 DLL fix
# 28-May-99 I-03-11  ksi        @@6 Link as ST
# 11-Mar-00 J-01-04  CHI        @@7 remove unneeded "del", obsolete /f
# 10-Nov-00 J-01-21  rct        $$1 IA64_NT
# 24-Aug-01 J-03-07  mkulkarn   $$2 Added note for compilation using WinMain()
# 18-Sep-01 J-03-07+ HMR        $$3 Added netapi32.lib for ctpfafs.
# 27-Jan-04 K-01-22+ hplab      $$4 update ia64_nt .NET compilers Itanium2
# 04-Jun-04 K-03-03  ASRS       $$5 x86e_win64 support
# 03-Aug-04 K-03-07  shkulkar   $$6 removed obsolete compiler options
# 27-Aug-04 K-03-09  ksi        $$7 Added psapi.lib
# 15-SEP-04 K-03-10  MTP        $$8 Updated for new compiler
# 17-Jan-06 L-01-01  asaha      $$9 Updated for Microsoft Visual Studio 8 compiler
# 03-May-06 L-01-07  TWH        $$10 add windows libraries
# 20-Jun-06 L-01-10+ KSV        $$11 added ole32.lib
# 08-Mar-07 L-01-29  SNAG       $$12 Rename exe and dll due to vista issue.
# 03-May-07 L-01-31  VSA        $$13 Added PTApplsUnicodeUtils object dependency
# 16-May-08 L-03-09  AC         $$14 VS2008 porting changes
# 03-Jun-08 L-03-10  BI         $$15 Added ws2_32.lib 
# -----------------------------------------------------------------------------
# File Name
MAKEFILENAME = make_tesinapre

# Machine Type
PRO_MACHINE_TYPE = i486_nt

# Executable names
EXE = pt_tesinaPre.exe
EXE_DLL = pt_tesinaPre.dll

# Pro\Toolkit Source & Machine Loadpoint  (EXTERNAL USE - DEFAULT)
PROTOOL_SRC = C:\proprue
PROTOOL_SYS = $(PROTOOL_SRC)/$(PRO_MACHINE_TYPE)
PRODEV_SRC = C:\proprue\prodevelop
PRODEV_SYS = $(PRODEV_SRC)\$(PRO_MACHINE_TYPE)

# Pro/Toolkit Source & Machine Loadpoint  (PTC INTERNAL USE)
#PROTOOL_SRC = $(PTCSRC)/protoolkit
#PROTOOL_SYS = $(PTCSYS)

# Include File Paths
INCS = -I. -I$(PROTOOL_SRC)/protk_appls/includes -I$(PROTOOL_SRC)/includes 

# Compiler Flags
CC = cl
MACH = -DPRO_MACHINE=29 -DPRO_OS=4
CCFLAGS = -c -fp:precise -DUSE_ANSI_IOSTREAMS  
CFLAGS = $(CCFLAGS) $(INCS) $(MACH)

# Libraries
PTCLIBS = $(PROTOOL_SYS)/obj/protoolkit.lib $(PRODEV_SYS)/obj/prodevelop.lib
PTCLIBS_DLL = $(PROTOOL_SYS)/obj/protk_dll.lib $(PRODEV_SYS)/obj/prodev_dll.lib
LIBS = libcmt.lib kernel32.lib user32.lib wsock32.lib advapi32.lib mpr.lib winspool.lib netapi32.lib psapi.lib gdi32.lib shell32.lib comdlg32.lib ole32.lib ws2_32.lib

# Object files
OBJS = pt_main.obj pt_graphics.obj pt_dbase.obj pt_anim.obj pt_utils.obj pt_publish.obj pt_Dbms.obj pt_ayuda.obj


# Linker
LINK = link

$(EXE) :  $(OBJS) $(PTCLIBS)
        @echo Start at `date`
        @echo PROTOOL_SRC = $(PROTOOL_SRC)
        @echo PROTOOL_SYS = $(PROTOOL_SYS)
#Executable applications compiled using WinMain() instead of main() should set the subsystem to windows instead of console.
        $(LINK) /subsystem:console -out:$(EXE) /debug:none /machine:i486_nt @<<longline.list
$(OBJS) $(PTCLIBS) $(LIBS)
<<
        
        @echo Finished at `date`
        del $(OBJS)

# Dll target
dll: $(EXE_DLL)

$(EXE_DLL) :  $(OBJS) $(PTCLIBS_DLL)
        @echo Start at `date`
        @echo PROTOOL_SRC = $(PROTOOL_SRC)
        @echo PROTOOL_SYS = $(PROTOOL_SYS)
        $(LINK) /subsystem:console -out:$(EXE_DLL) /debug:none /machine:i486_nt /dll @<<longline.list
$(OBJS) $(PTCLIBS_DLL) $(LIBS)
<<

        @echo Finished at `date`
        del $(OBJS)

# object dependencies

PROTK_APPLS = $(PROTOOL_SRC)/protk_appls/pt_tesinaPre

pt_main.obj: $(PROTK_APPLS)/pt_main/pt_main.c
        $(CC) $(CFLAGS) $(PROTK_APPLS)/pt_main/pt_main.c

pt_graphics.obj: $(PROTK_APPLS)/pt_graphics/pt_graphics.c
        $(CC) $(CFLAGS) $(PROTK_APPLS)/pt_graphics/pt_graphics.c
        
pt_dbase.obj: $(PROTK_APPLS)/pt_dbase/pt_dbase.c
        $(CC) $(CFLAGS) $(PROTK_APPLS)/pt_dbase/pt_dbase.c        
        
pt_anim.obj: $(PROTK_APPLS)/pt_anim/pt_anim.c
        $(CC) $(CFLAGS) $(PROTK_APPLS)/pt_anim/pt_anim.c
        
pt_utils.obj: $(PROTK_APPLS)/pt_utils/pt_utils.c
        $(CC) $(CFLAGS) $(PROTK_APPLS)/pt_utils/pt_utils.c

pt_publish.obj: $(PROTK_APPLS)/pt_publish/pt_publish.c
        $(CC) $(CFLAGS) $(PROTK_APPLS)/pt_publish/pt_publish.c
        
pt_Dbms.obj: $(PROTK_APPLS)/pt_Dbms/pt_Dbms.c
        $(CC) $(CFLAGS) $(PROTK_APPLS)/pt_Dbms/pt_Dbms.c
        
pt_ayuda.obj: $(PROTK_APPLS)/pt_ayuda/pt_ayuda.c
        $(CC) $(CFLAGS) $(PROTK_APPLS)/pt_ayuda/pt_ayuda.c

clean :
        del $(OBJS)
        del $(EXE)
        nmake -f $(MAKEFILENAME)

clean_dll :
        del $(OBJS)
        del $(EXE_DLL)
        nmake -f $(MAKEFILENAME) dll