include ../../Common.Mk

distfile = fltk_projects.orig.tar.bz2
workdir = fltk_projects
bdepends += fltk-1.3-ja-dev gettext
confflag += 
patches = `find patches -name "*.patch"`

unins_list = fltk-1.10.tcz.list fltk_base-dev.tcz.list
tcexpand_list = fltk-1.3-ja fltk-1.3-ja-dev

apps = apps cpanel datetool exittc filetool flrun mnttool mousetool network popask popup scmapps services stats swapfile tc-wbarconf wallpaper tc-install
msgfile = ja.mo
delfiles += $(msgfile)
localedir = /usr/local/share/locale/ja/LC_MESSAGES

.PHONY: extract configure build install

%.mo: %.po
	msgfmt -o $@  $<

extract:
	$(TAR) xf $(distfile)

configure:

build: uninstall tcexpand $(msgfile)
	@for i in $(apps); do \
		dir=`pwd`; \
		cd $(workdir)/$$i; \
		g++ $$i.cxx $(CXXFLAGS) -lfltk -lX11 -lXext -o $$i; \
		[ "$$?" != "0" ] && exit 1; \
		cd $$dir; \
	done
	cd $(workdir); g++ editor.cxx $(CXXFLAGS) -lfltk -lX11 -lXext -o editor/editor

install:
	for i in $(apps); do \
		sudo install -o root -g root -m 755 --strip $(workdir)/$$i/$$i $(bindir); \
	done
	sudo install -o root -g root -m 755 --strip $(workdir)/editor/editor $(bindir)
	sudo install -o root -g root -m 755 -d $(localedir)
	sudo install -o root -g root -m 644 -T $(msgfile) $(localedir)/tinycore.mo
