include ../../Makefile.conf

TTFDUMP_MODULES=Main.o

ifeq ($(SPLATFORM),WINDOWS)
TTFDUMP_OBJS=$(subst .o,.obj,$(TTFDUMP_MODULES))
SLIBS=/libpath:../../stoolkit stoolkit.lib
SWINLIBS=/libpath:../../swindow  swindow.lib
SWIDGETLIBS=/libpath:../../swidget swidget.lib
CLIBS=/link /subsystem:CONSOLE $(SWIDGETLIBS) $(SWINLIBS) $(SLIBS) $(SWINDOW_LIBS) $(ALL_LIBS)
WLIBS=/link /subsystem:WINDOWS $(SGUILIBS) $(SWIDGETLIBS) $(SWINLIBS) $(SLIBS) $(SWINDOW_LIBS) $(ALL_LIBS) \lm
else
TTFDUMP_OBJS=$(TTFDUMP_MODULES)
SLIBS=-L../../stoolkit -lstoolkit
SWINLIBS=-L../../swindow -lswindow 
SWIDGETLIBS=-L../../swidget -lswidget 
#CLIBS=-Xlinker -Bstatic $(SWIDGETLIBS) $(SWINLIBS) $(SLIBS) $(ALL_LIBS)
CLIBS=$(SWIDGETLIBS) $(SWINLIBS) $(SLIBS) $(ALL_LIBS) -lm
WLIBS=$(SLIBS) $(ALL_LIBS)
endif

.PHONY:all clean config 

all: ttfdump

ttfdump: $(TTFDUMP_OBJS) 
	$(LD) -o ttfdump $(TTFDUMP_OBJS) $(CLIBS)

%.o:%.cpp
	$(CXX) -c $(CPPFLAGS) $(subst .o,.cpp,$@)

%.obj:%.cpp
	$(CXX) -c $(CPPFLAGS) $(subst .obj,.cpp,$@)

install:
	rm -f $(bindir)/mw
	$(INSTALL_PROGRAM) mw $(bindir)

clean: 
	rm -f core *.o *.obj ttfdump ttfdump.exe 

$(SUBDIRS_clean):
	$(MAKE) -C $(patsubst %_clean,%,$@) clean

depend:
	$(CXX) -M  $(CPPFLAGS)  $(patsubst %.o,%.cpp,$(TEST_OBS)) > .depend


ifeq (.depend, $(wildcard .depend))
include .depend
endif
