WXDIR = c:/wx2
WXINC=$(WXDIR)/include
APPNAME = pmMain
TARGET = $(APPNAME).exe
RM = rm -f
RC = windres.exe
CC = g++
STRIP = strip.exe

OBJECTS = $(APPNAME).o $(APPNAME)_resources.o table.o tqsql.o pmMainframe.o pmBasicframe.o \
                pmBasicdlg.o pmSQLdlg.o pmCanvas.o pmGrid.o pmSRCdlg.o

INCLUDES = -I$(WXINC) -I$(WXDIR)/contrib/include -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg \
                -I$(WXDIR)/src/zlib -I$(WXDIR)/src/xpm -I$(WXDIR)/src/tiff

CCSW1 = --pipe -fvtable-thunks -c -D_X86_=1 -DWIN32 -D_WIN32 -DWINVER=0x0400 \
        -D__GNUWIN32__ -D__WIN32__ -DSTRICT  -D__WXMSW__ -D__WINDOWS__\
        -Wall -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions

CCSW2 = --pipe -fvtable-thunks -Wl,--subsystem,windows -mwindows

#WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx.$(LIBSUFF)

#
#The libraries are assumed to be in the standard lib location
#
LIBS  = -lwx -lxpm -lcomctl32 -ladvapi32 -lwsock32 -lole32 -loleaut32 -luuid -lodbc32 -lpng \
        -ljpeg -lzlib -lxpm -ltiff

RESSW = --include-dir c:/wx2/include --define __WIN32__ --define __GNUWIN32__

$(TARGET): $(OBJECTS)
        $(CC) -o $@ $(OBJECTS) ${CCSW2} ${LIBS}

.cpp.o:
        $(CC) ${CCSW1} ${INCLUDES} -o $@ $<

$(APPNAME)_resources.o: $(APPNAME).rc
        $(RC) ${RESSW} $(APPNAME).rc $@


.SUFFIXES: .cpp .o

.PHONY : clean

clean:
        echo cleaning up
        $(RM) $(OBJECTS)
        $(RM) *.tmp
        $(STRIP) $(APPNAME).exe