# define a list of pkg-config packages we want to use
pkg_packages := gtk+-2.0 cairo

# get the necessary flags for compiling
PKG_CFLAGS := $(shell pkg-config --cflags $(pkg_packages))
# get the necessary flags for linking
PKG_LDFLAGS := $(shell pkg-config --libs $(pkg_packages))

CC := g++ -Wall
CFLAGS := $(PKG_CFLAGS) -I/usr/include/gtk-2.0 
LDFLAGS :=  -lX11 -lXtst -lXext $(PKG_LDFLAGS) 

OBJFILES := dialog.o hibernate.o main.o monitor.o resolution.o vga.o video.o

.SUFFIXES: .o .cpp

targets = osd

all: $(targets)

.cpp.o:
	$(CC) $(CFLAGS) -c $< -o $@

osd: $(OBJFILES)
	$(CC) $^ -o $@ $(LDFLAGS)

install: $(targets)
	install -d $(DESTDIR)/usr/bin/
	install $(targets) $(DESTDIR)/usr/bin/
	
clean:
	rm -f *.o osd
