CXXFLAGS=-O3 -fPIC `pkg-config Qt5Widgets --cflags`
LDFLAGS=-lgecodedriver -lgecodesupport -lgecodekernel -lgecodesearch -lgecodeint -lgecodeminimodel -lgecodegist -lgecodeset -lgecodefloat -lpthread `pkg-config Qt5Widgets --libs`
EXAMPLES=$(patsubst %.cpp,%,$(wildcard *.cpp)) $(patsubst %.cpp.gz,%,$(wildcard *.cpp.gz))

all: $(EXAMPLES)

examples/scowl.hpp examples/sudoku-instances.hh $(addsuffix .cpp,$(EXAMPLES)):
	gunzip $@.gz

$(addsuffix .o,$(EXAMPLES)): $(addsuffix .cpp,$(EXAMPLES)) examples/scowl.hpp examples/sudoku-instances.hh
	g++ $(CXXFLAGS) $(patsubst %.o,%.cpp,$@) -c

clean:
	rm -f $(EXAMPLES)
	rm -f *.o

.PHONY: all clean

.SECONDEXPANSION:
$(EXAMPLES): $$@.o
	g++ $@.o -o $@ $(LDFLAGS)
