include ../Makefile.conf

MODULES=Main.o 

ifeq ($(SPLATFORM),WINDOWS)
OBJS=$(subst .o,.obj,$(MODULES))
SLIBS=/libpath:../stoolkit stoolkit.lib
MYLIBS=/link /subsystem:CONSOLE $(SLIBS) $(ALL_LIBS)
else
OBJS=$(MODULES)
SLIBS=-L../stoolkit -lstoolkit
MYLIBS=$(SLIBS) $(ALL_LIBS)
endif

.PHONY:all clean config 

all:  uniconv

uniconv: $(OBJS)
	$(LD) -o uniconv $(OBJS) $(MYLIBS)

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

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

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

install:
	rm -f $(DESTDIR)/$(bindir)/uniconv
	$(INSTALL_PROGRAM) uniconv $(DESTDIR)/$(bindir)
	$(INSTALL_DATA) uniconv.1 $(DESTDIR)/$(mandir)/man1

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

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

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