#
#  Makefile for PCC II
#
#  This defines the non-standard parts of the Windows build (standard rules
#  are in Rules-mingw.mak).
#

## Dependency generator needs $(OBJEXT)
OBJEXT = o

## Output formatter needs !include
FMT_INCLUDE = include
FMT_SAFE_NAMES = yes

## Tweaks
CXXFLAGS +=
LDFLAGS +=

# This all sucks (but a little less than before).
CXX_pcc-v2        :+= -Wl,--subsystem=windows
FILES_pcc-v2       += arch/win32-bcc55/SDL_main.c
CXX_playvcr       :+= -Wl,--subsystem=windows
FILES_playvcr      += arch/win32-bcc55/SDL_main.c
CXX_c2reshack     :+= -Wl,--subsystem=windows
LIBS_c2reshack     += -luser32 -lgdi32 -lcomdlg32
FILES_c2reshack    += arch/win32-bcc55/SDL_main.c
CXX_vcrwrap       :+= -Wl,--subsystem=windows

# reshack font import
FILES_c2reshack    += reshack/w32import.cc
CXXFLAGS_reshack/reshack.cc :+= -DUSE_W32IMPORT

# c2pluginw
FILES_c2pluginw    = tools/c2pluginw.cc
TYPE_c2pluginw     = app
CXX_c2pluginw    :+= -Wl,--subsystem=windows
DEPEND_c2pluginw   = pcc2 platf cplus
TARGETS           += c2pluginw

# We need CFLAGS to compile SDL_main.o. FIXME.
CFLAGS = $(CXXFLAGS)

# Platform library
TARGETS += platf
TYPE_platf = lib
FILES_platf = arch/win32-bcc55/platform.cc arch/win32-bcc55/dirs.cc \
        arch/win32-bcc55/output.cc arch/win32/file.cc \
        arch/win32-bcc55/shell.cc arch/win32/win32.cc \
        arch/win32/console.cc

# But this sucks. This puts io/dirs.o into libplatf.a as well, because the linker
# doesn't always pick it when seeing it first in libpcc2.a. Probably Borland just
# has to be better at *something*.
FILES_platf += io/dirs.cc

## Configuration for cpluslib. Should go in 01_cpluslib someday, but currently
## it must be here because it references an operating system command which,
## under Windows, means the shell is too stupid to deal with a generic version
## using forward slashes.
cpluslib/cpluslib/config.h: cpluslib/cpluslib/config.in
        cat cpluslib/cpluslib/config.in > cpluslib/cpluslib/config.h

# VCR wrapper
TARGETS += vcrwrap
TYPE_vcrwrap = app
FILES_vcrwrap = installer/vcrwrap.cpp
