include ../sys/config/mkdirs

all::
	-@for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) ); \
	done

clean::
	-@for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) clean); \
	done
	-\rm -f ../lib/_mpfcmodule.so;
	-\rm -f ./pythonlib/_mpfcmodule.so;
	-\rm -f ../lib/mpfc.py;
	-\rm -f ../lib/mpfc.so;
	-\rm -f ../lib/mpfc_perl.so;
	-\rm -f ../lib/mpfc.pm;

debug::
	-@for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) debug); \
	done

runtime::
	-@for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) runtime); \
	done

static::
	-@for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) static); \
	done

static-debug::
	-@for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) static-debug); \
	done

include ../sys/config/mkflags
install::
	@cd ..;
	@if [ -d $(WS_DEFAULT_DIR) ]; then set +x;\
	else (set -x; mkdir $(WS_DEFAULT_DIR)); fi
	pwd;
	-(cd ..;\cp -r bin $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r include $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r samples $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r sys $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r lib $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r doc $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r COPYRIGHT $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r Changelog $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r README $(WS_DEFAULT_DIR));
	-(cd ..;\cp -r README.eucjp $(WS_DEFAULT_DIR));
	-\ln -f -s $(WS_DEFAULT_DIR)/lib/* $(WS_INST_DIR)/lib
	-\ln -f -s $(WS_DEFAULT_DIR)/bin/ws* $(WS_INST_DIR)/bin

uninstall::
	-\rm -rf $(WS_DEFAULT_DIR);
	-\rm -f $(WS_INST_DIR)/lib/_mpfcmodule.*;
	-\rm -f $(WS_INST_DIR)/lib/mpfc.*;
	-\rm -f $(WS_INST_DIR)/lib/mpfc-old.*;
	-\rm -f $(WS_INST_DIR)/lib/mpfc_perl.*;
	-\rm -f $(WS_INST_DIR)/lib/mpfc_perl-old.*;
	-\rm -f $(WS_INST_DIR)/lib/libws.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsb.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsc.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsd.*;
	-\rm -f $(WS_INST_DIR)/lib/libwse.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsf.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsr.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsj3w.*;
	-\rm -f $(WS_INST_DIR)/lib/libwssheet.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsodbc.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsnx.*;
	-\rm -f $(WS_INST_DIR)/lib/libwspostgres.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsmysql.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsopengl.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsad.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsx11.*;
	-\rm -f $(WS_INST_DIR)/lib/libwsnsplugin.*;
	-\rm -f $(WS_INST_DIR)/lib/lib-btron;
	-\rm -f $(WS_INST_DIR)/lib/lib-te-*;
	-\rm -f $(WS_INST_DIR)/lib/jpg.*;
	-\rm -f $(WS_INST_DIR)/lib/xpm.*;
	-\rm -f $(WS_INST_DIR)/lib/png.*;
	-\rm -f $(WS_INST_DIR)/bin/wsbuilder;
	-\rm -f $(WS_INST_DIR)/bin/wsbuilder.sh;
	-\rm -f $(WS_INST_DIR)/bin/wsbuilderd;
	-\rm -f $(WS_INST_DIR)/bin/wstitle;
	-\rm -f $(WS_INST_DIR)/bin/wsagent;
	-\rm -f $(WS_INST_DIR)/bin/wsreset;
	-\rm -f $(WS_INST_DIR)/bin/wssearch;
	-\rm -f $(WS_INST_DIR)/bin/wstracer;
	-\rm -f $(WS_INST_DIR)/bin/wsgdb_mac;

btron::
	-@for i in base base1 base2 base3 base4 advance j3wlib btron net wsbuilder title wsagent; do \
	(cd $$i && $(MAKE) -f makefile.btron); \
	done

btron-clean::
	-@for i in base base1 base2 base3 base4 advance j3wlib btron net wsbuilder title wsagent; do \
	(cd $$i && $(MAKE) -f makefile.btron clean); \
	done

te-sh7760::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-sh7760 -f makefile.te); \
	done

te-sh7760-clean::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-sh7760 -f makefile.te clean); \
	done

te-sh7751r::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-sh7751r -f makefile.te); \
	done

te-sh7751r-clean::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-sh7751r -f makefile.te clean); \
	done

te-sh7727::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-sh7727 -f makefile.te); \
	done

te-sh7727-clean::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-sh7727 -f makefile.te clean); \
	done

te-mc9328::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-mc9328 -f makefile.te); \
	done

te-mc9328-clean::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-mc9328 -f makefile.te clean); \
	done

te-vr5500::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-vr5500 -f makefile.te); \
	done

te-vr5500-clean::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-vr5500 -f makefile.te clean); \
	done

te-vr5701::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-vr5701 -f makefile.te); \
	done

te-vr5701-clean::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-vr5701 -f makefile.te clean); \
	done

te-mb87q1100::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-mb87q1100 -f makefile.te); \
	done

te-mb87q1100-clean::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-mb87q1100 -f makefile.te clean); \
	done

te-tx4956::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-tx4956 -f makefile.te); \
	done

te-tx4956-clean::
	-@for i in base base1 base2 base3 base4 j3wlib btron net; do \
	(cd $$i && $(MAKE) TARGET_ARC=te-tx4956 -f makefile.te clean); \
	done

