all: omedit

resourcedir=./OMEditLIB/Resources/nls/

NAME=OMEdit
APP=@APP@
LIB=libOMEdit
LIBEXE=.a
QMAKE=@QMAKE@
LRELEASE=@LRELEASE@

CMAKE=CC="@CC@" CXX="@CXX@" CFLAGS="@CFLAGS@" CPPFLAGS="@CPPFLAGS@" cmake
CMAKE_TARGET = "Unix Makefiles"

install: build OMEditLIB/Resources/nls/qm.stamp
	cp -p $(resourcedir)/*.qm @OMBUILDDIR@/share/omedit/nls/
	if [ "$(APP)" = ".app" ]; then mkdir -p @OMBUILDDIR@/Applications/ ; cp -rp bin/OMEdit$(APP) @OMBUILDDIR@/Applications/ ; else cp -p bin/OMEdit @OMBUILDDIR@/bin/; fi

OMEditLIB/Resources/nls/qm.stamp: OMEditLIB/OMEditLIB.pro OMEditLIB/Resources/nls/*.ts
	$(LRELEASE) $<
	@touch $@

$(NAME): parsergen Makefile omedit_config.h
	$(MAKE) -f Makefile

build: $(NAME)

parsergen:
	$(MAKE) -C OMEditLIB/Debugger/Parser -f Makefile.lib.unix

Makefile: OMEdit.pro OMEditLIB/OMEditLIB.unix.config.pri OMEditGUI/OMEditGUI.unix.config.pri omedit_config.h
	$(QMAKE) -r
Makefile.unix: Makefile.unix.in
	(cd @top_builddir@; ./config.status)
OMEditLIB/OMEditLIB.unix.config.pri: OMEditLIB/OMEditLIB.unix.config.pri.in
	(cd @top_builddir@ && ./config.status)
OMEditGUI/OMEditGUI.unix.config.pri: OMEditGUI/OMEditGUI.unix.config.pri.in
	(cd @top_builddir@ && ./config.status)
omedit_config.h: omedit_config.h.in
	(cd @top_builddir@ && ./config.status)

mkbuilddirs:
	mkdir -p  @OMBUILDDIR@/share/omedit/nls @OMBUILDDIR@/bin @OMBUILDDIR@/lib/@host_short@/omc
omedit: mkbuilddirs install

clean:
	$(MAKE) -C OMEditLIB/Debugger/Parser -f Makefile.lib.unix clean
	test ! -f Makefile || $(MAKE) -f Makefile clean
	rm -f bin/OMEdit$(APP) bin/$(LIB)$(LIBEXE)
	rm -rf omedit_config.h Makefile OMEditLIB/debug OMEditLIB/release OMEditLIB/generatedfiles OMEditLIB/Makefile OMEditLIB/Makefile.Debug OMEditLIB/Makefile.Release OMEditLIB/object_script.* OMEditGUI/debug OMEditGUI/release OMEditGUI/Makefile OMEditGUI/Makefile.Debug OMEditGUI/Makefile.Release

distclean: clean
	rm -rf config.log config.sub config.status install-sh autom4te.cache config.guess configure Makefile.unix OMEditLIB/OMEditLIB.unix.config.pri OMEditGUI/OMEditGUI.unix.config.pri

config.status: configure
	./config.status -recheck
configure: configure.ac common/m4/corba.m4 common/m4/omhome.m4 common/m4/qmake.m4
	autoconf
