CURDIR=diawxxt
LOCAL_CLEAN=local_clean

INCLWX=/usr/include/wx
#INCLWX=/tmp/wxxt/wxxt-1.67/wx

WXXTLIBS=-lwx_xt -lwx_xtwidgets
#WXXTLIBS=/tmp/wxxt/wxxt-1.67/lib/linux-gnu/libwx_xt.a \
#	/tmp/wxxt/wxxt-1.67/lib/linux-gnu/libwx_xtwidgets.a

WXXT_INSTALLED := $(shell if [ -f /usr/X11R6/lib/libwx_xt.a ]; \
	then if [ -f $(INCLWX)/wx.h -o -f /usr/include/wxxt/wx.h ]; \
		then echo 1; \
		else echo 0; fi \
	else echo 0; fi )

ifeq ($(WXXT_INSTALLED),0)
all:
	@echo "Can't compile diawxxt because wxXt is not installed"
	@echo "The GUI frontend won't be compiled"
	@echo "but linuxconf itself will be ok."
	@echo "If you want to compile the GUI frontend, install the"
	@echo "wxxt toolkit from ftp://ftp.solucorp.qc.ca/pub/linuxconf/wxxt"
	@echo "Note that to successfully rebuild the RPM version, you need"
	@echo "to install this toolkit"

install:
	@echo Nothing to install

clean:
	@echo Nothing to clean

else


LOCAL_INSTALL=local_install

all: lib remadmin
OBJS = defs.o error.o protowx.o book.o clist.o combo.o \
	formbase.o formbutton.o \
	group.o group_fit.o \
	hline.o layout.o layoutbook.o mainform.o mform.o \
	richtext.o sheet.o \
	str.o str1.o textarea.o tree.o diawxxt.o

include ../rules.mak

INCLUDES=-I$(INCLWX) -I/tmp/wxxt/wxxt-1.67/setup/linux-gnu -I/usr/include/wxxt

proto:
	proto -m0+ -bdiawxxt.h+diawxxt.pm \
		-bremadmin.cc+diawxxt.pm \
		-bmform.cc+diawxxt.pm \
		-berror.cc+diawxxt.pm \
		*.cc

remadmin: remadmin.o diawxxt.a
	$(GPPLINK) -g remadmin.o diawxxt.a -o wxxt-linuxconf \
		-L/usr/X11R6/lib \
		-Xlinker -Bstatic $(WXXTLIBS)  -Xlinker -Bdynamic \
		-lXpm -lXaw -lXt -lXmu -lSM -lICE -lXext -lX11 -lstdc++


local_install:
	mkdir -p $(X11R6_BIN)
	install -c $(INSTROOT) -m 755 wxxt-linuxconf $(X11R6_BIN)

endif

local_clean:
	rm -f wxxt-linuxconf

