INCLUDES = -I/usr/include/mysql
LIBS = -L/usr/include/mysql -L/usr/lib/mysql -lmysqlclient -lz
GTK-CONFIG = `gtk-config --cflags --libs`


Prowizje: main.o interface.o support.o callbacks.o comm_utils.o ddc.o
	gcc -o Prowizje *.o $(GTK-CONFIG) $(INCLUDES) $(LIBS)

main.o : main.c
	gcc -c main.c $(GTK-CONFIG)

interface.o : interface.c
	gcc -c interface.c $(GTK-CONFIG)

support.o : Support.c
	gcc -c Support.c $(GTK-CONFIG)

callbacks.o : callbacks.c
	gcc -c callbacks.c $(GTK-CONFIG)

comm_utils.o : comm_utils.c
	gcc -c comm_utils.c $(GTK-CONFIG) $(INCLUDES)

ddc.o : Ddc.c
	gcc -c Ddc.c $(GTK-CONFIG) $(INCLUDES)

clean::
	rm -f $(PROG).o $(PROG)


EXE_LOCATION = /usr/local/bin/
MENU_LOCATION = "/usr/share/gnome/apps/Utworzone programy/"

# In the commands below...
#     The -p after mkdir tells mkdir not to return an error if the
#            directory already exists.
#     The -f after cp tells cp to overwrite an existing file of
#            the same name in the target location, if the file 
#            already exists.

install : Prowizje
	echo $(MENU_LOCATION)
	mkdir -p $(MENU_LOCATION)
	cp -f "Prowizje.desktop" $(MENU_LOCATION)
	cp -f Prowizje $(EXE_LOCATION)Prowizje
	chmod 755 $(EXE_LOCATION)Prowizje
	echo Prowizje zainstalowano
