CC= bcc32

# -P            force C++ compile
# -Ot           optimize for speed
# -Oc           optimize common subexpressions locally
# -Og           optimize common subexpressions globally
# -Oa           assume no pointers are aliased (may be unsafe)
# -O            reorganize loops and switches
# -Z            suppress redundant register loads
# -Ob           eliminate dead code (requires -Oe option)
# -Oe           enable global register allocation and variable live range analysis
# -Oi           inline some intrinsic functions (strXXX memXXX alloca fabs rotl rotr)
# -Om           move invariant code out of loops
# -Op           propagate what was assigned to a variable to assignments out of it
# -Ov           create induction variables and expression strength reduction (mostly for loops)
# -WX           generate DPMI 32-bit executable
# -5            optimize for Pentium processor
# -w-pro       #turns off warnings about calls to functions w/o prototypes
# -v            include debug symbols in object files and executable
# -vi          #allow inline functions
# -TD__DPMI32__ tell the assembler to define symbol "__DPMI32__" as 0
# -x-           disable exception handling
#
#CFLAGS= -Otcgabeimpv -O -Z -WX -5 -v -x- -vi
CFLAGS= -Otcgabeimpv -O -Z -WX -5 -v -x-

PROG=   foretest
SRCS=   foretest.cpp
OBJS=   foretest.obj timestmp.obj intr2.obj intr.obj pci32.obj phys.obj

all:    $(PROG)

#$(SRCS): byteswap.h

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

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

foretest.obj: foretest.cpp

timestmp.obj: ..\intel\timestmp.cpp
    $(CC) $(CFLAGS) -c ..\intel\timestmp.cpp

intr.obj: ..\dpmi32\intr.c
    $(CC) $(CFLAGS) -c ..\dpmi32\intr.c

phys.obj: ..\dpmi32\phys.c
    $(CC) $(CFLAGS) -c ..\dpmi32\phys.c

intr2.obj: ..\dpmi32\intr2.asm
    # ok     tasm32 /r /D__CDECL__ /m2 /ml intr2.asm
    # bad    tasm32 /Zi /m2 /ml intr2.asm
    # bad    tasm32 /D__CDECL__ /r /zi /m2 /ml intr2.asm
    tasm32 /r /D__CDECL__ /m2 /ml ..\dpmi32\intr2.asm

pci32.obj: ..\pci\pci32.asm
    tasm32 /r /D__CDECL__ /m2 /ml ..\pci\pci32.asm

$(PROG):    $(OBJS)
    $(CC) $(CFLAGS) @&&!
$(OBJS)
!
