#
#TpbkGui release version
#V1.00 first release(2018/09) - TPBK(LNX) v2.02
#

#ifneq ($(shell whoami), root)
#$(error "Require root privilege!")
#endif

#Check Manufacturer
#ifneq ($(shell dmidecode --type system | grep "Manufacturer" | cut -f 2 -d ' '), $(filter $(shell dmidecode --type system | grep "Manufacturer" | cut -f 2 -d ' '), CONTEC))
#$(error "This Product is not supported!")
#endif

#Check Product name
#ifneq ($(shell dmidecode --type system | grep "Product" | cut -f 3 -d ' '), $(filter $(shell dmidecode --type system | grep "Product" | cut -f 3 -d ' '), PT-956SLX))
#$(error "This Product is not supported")
#endif

#PRODUCT_NAME = $(shell dmidecode --type system | grep "Product" | cut -f 3 -d ' '| cut -f 1 -d '-')$(shell dmidecode --type system | grep "Product" | cut -f 3 -d ' '| cut -f 2 -d '-')
#MANUFACTRER = $(shell dmidecode --type system | grep "Manufacturer" | cut -f 2 -d ' ')

CC ?= gcc
GTK =  -lTpAPI -lX11  -L/usr/X11R6/lib -rdynamic $(shell pkg-config --cflags --libs gtk+-2.0)
OBJS = TPBKGUI.c

INSDIR = /opt/contec/tpbkGuiUtility

all:$(OBJS)
	$(CC) -o TpbkGuiUtil $(OBJS) $(GTK)

TPBKGUI.o:TPBKGUI.c
	$(CC) -c TPBKGUI.c $(GTK)

#TPBKGUI:TPBKGUI.c
#	$(CC) TPBKGUI.c -o TPBKGUI $(GTK)

install:
	install -D ./TpbkGuiUtil $(INSDIR)/TpbkGuiUtil
	cp ./TpbkGUI.glade $(INSDIR)/TpbkGUI.glade
	cp -r ./icon $(INSDIR)/icon
	install -m 0655 ./TpbkGUIrunA.sh $(INSDIR)/TpbkGUIrunA.sh
	install -m 0655 ./TpbkGUIrunB.sh $(INSDIR)/TpbkGUIrunB.sh
	cp ./TPBK_util.desktop /usr/share/applications/TPBK_util.desktop
#	cp -r ./locale $(INSDIR)/locale
	cp -r ./help $(INSDIR)/help
	chmod +x $(INSDIR)/help/tpbkutilhelp.sh

uninstall:
	rm -rf $(INSDIR)
	rm -f /usr/share/applications/TPBK_util.desktop

clean:
	rm -f *.o TpbkGuiUtil
