CFLAGS = -w
LDLIBS = `pkg-config --cflags --libs gtk4` `pkg-config --cflags --libs json-glib-1.0`

.PHONY: all
all: 
# bear generates the compile_commands.json file by capturing gcc output, which
# helps the IDE resolving partial paths to system include files e.g. <gtk/gtk.h>
	cd src/ && glib-compile-resources resources.gresource.xml --target=resources.gresource.c --generate-source
	mkdir -p bin
	$(warning bear -- $(CC) $(CFLAGS) $(LDFLAGS) -o bin/demo src/main.c src/service_status.c src/service_model.c src/resources.gresource.c  $(LDLIBS))
	bear -- $(CC) $(CFLAGS) $(LDFLAGS) -o bin/demo src/main.c src/service_status.c src/service_model.c src/resources.gresource.c  $(LDLIBS)

clean:
	rm src/resources.gresource.c
	rm -rf bin

install:
	sudo cp bin/demo /usr/local/bin

uninstall:
	sudo rm /usr/local/bin/demo