# fotoxx-maps makefile 

CXXFLAGS += -Wall -Wno-format-truncation

PKG_CONFIG ?= pkg-config

### CFLAGS = $(CXXFLAGS) -c  `pkg-config --cflags gtk+-3.0`

CFLAGS = $(CXXFLAGS) $(CPPFLAGS) -c                \
   `$(PKG_CONFIG) --cflags gtk+-3.0`               \
   -I/usr/include/clutter-1.0/                     \
   -I/usr/include/cogl/                            \
   -I/usr/include/json-glib-1.0/                   \
   -I/usr/include/clutter-gtk-1.0/

### LIBS = `pkg-config --libs gtk+-3.0` -lpthread

LIBS = `$(PKG_CONFIG) --libs gtk+-3.0`  -lpthread -lrt                           \
        -lclutter-1.0 -lclutter-gtk-1.0 -lchamplain-0.12 -lchamplain-gtk-0.12

fotoxx-maps: fotoxx-maps.o zfuncs.o   
	$(CXX) $(LDFLAGS) -o fotoxx-maps fotoxx-maps.o zfuncs.o $(LIBS)  \

fotoxx-maps.o: fotoxx-maps.cc
	$(CXX) $(CFLAGS) -o fotoxx-maps.o fotoxx-maps.cc  \

zfuncs.o: zfuncs.cc zfuncs.h
	$(CXX) $(CFLAGS)  zfuncs.cc  \

# target install directories
PREFIX ?= /usr
BINDIR = $(PREFIX)/bin
DOCDIR = $(PREFIX)/share/doc/fotoxx-maps
MANDIR = $(PREFIX)/share/man/man1
MENUDIR = $(PREFIX)/share/applications
SHAREDIR = $(PREFIX)/share/fotoxx-maps
DATADIR = $(SHAREDIR)/data
ICONDIR = $(SHAREDIR)/icons

install: fotoxx-maps uninstall
	mkdir -p  $(DESTDIR)$(BINDIR)
	mkdir -p  $(DESTDIR)$(DOCDIR)
	mkdir -p  $(DESTDIR)$(MANDIR)
	mkdir -p  $(DESTDIR)$(MENUDIR)
	mkdir -p  $(DESTDIR)$(DATADIR)
	mkdir -p  $(DESTDIR)$(ICONDIR)
	cp -f     fotoxx-maps $(DESTDIR)$(BINDIR)
	cp -n -R  doc/* $(DESTDIR)$(DOCDIR)
	cp -f -R  data/* $(DESTDIR)$(DATADIR)
	# man page
	gzip -fk -9 doc/fotoxx-maps.man
	mv -f doc/fotoxx-maps.man.gz $(DESTDIR)$(MANDIR)/fotoxx-maps.1.gz
	# menu (desktop) file
	cp -f fotoxx-maps.desktop $(DESTDIR)$(MENUDIR)
	cp -f fotoxx-maps.png $(DESTDIR)$(ICONDIR)

uninstall:
	rm -f  $(DESTDIR)$(BINDIR)/fotoxx-maps
	rm -f -R  $(DESTDIR)$(DOCDIR)
	rm -f  $(DESTDIR)$(MANDIR)/fotoxx-maps.*
	rm -f  $(DESTDIR)$(MENUDIR)/fotoxx-maps.*
	rm -f -R  $(DESTDIR)$(SHAREDIR)

clean:
	rm -f  fotoxx-maps
	rm -f  *.o

