
PREFIX    ?= /usr
MODULES    = settings weaver webview
CXXFLAGS  += -I/usr/include/qt6 -I/usr/include/qt6/QtCore -I/usr/include/qt6/QtWidgets -I/usr/include/qt6/QtGui
CXXFLAGS  += -I/usr/include/qt6/QtWebEngineWidgets -I/usr/include/qt6/QtWebEngineCore -I/usr/include/qt6/QtNetwork
CXXFLAGS  += -DPREFIX=$(PREFIX) -fPIC -std=c++17
LDLIBS    += -lstdc++ -lQt6WebEngineWidgets -lQt6Core -lQt6Widgets -lQt6Network -lQt6WebEngineCore -lQt6Gui
VPATH      = src/

weaver: $(MODULES:%=%.o)

%.o: %.cpp %.h

install: weaver
	install -Dm755 weaver $(DESTDIR)$(PREFIX)/bin/weaver
	install -Dm644 LICENSE $(DESTDIR)$(PREFIX)/share/licenses/weaver/LICENSE
	install -Dm644 examples/weaver.desktop $(DESTDIR)$(PREFIX)/share/applications/weaver.desktop
	install -Dm644 examples/config.conf $(DESTDIR)$(PREFIX)/share/doc/weaver/config.conf
	install -t $(DESTDIR)$(PREFIX)/share/doc/weaver/ examples/*.js

clean:
	rm *.o

distclean: clean
	rm weaver

.PHONY: clean install distclean
