DESTDIR= # leave empty for the current system or provide a fakeroot here PREFIX=/usr INSTALLATION=$(DESTDIR)$(PREFIX) BUILDDIR=build LIMOX_GO_PACKAGE=xengineering.eu/limox LIMOX=$(BUILDDIR)/limox LIMOX_INSTALL=$(INSTALLATION)/bin/limox DESKTOP_SRC=limox.desktop DESKTOP=$(BUILDDIR)/$(DESKTOP_SRC) DESKTOP_INSTALL=$(INSTALLATION)/share/applications/$(DESKTOP_SRC) IMG_NAMES=session IMG_DIR=$(BUILDDIR)/img IMGS=$(foreach wrd,$(IMG_NAMES),$(IMG_DIR)/$(wrd).pdf) all: $(LIMOX) $(DESKTOP) tests $(IMGS) $(BUILDDIR): mkdir $@ $(LIMOX): $(BUILDDIR) tests go build -o $@ $(LIMOX_GO_PACKAGE) $(DESKTOP): $(BUILDDIR) cp $(DESKTOP_SRC) $@ $(IMG_DIR): $(BUILDDIR) mkdir $@ $(IMG_DIR)/%.pdf: img/%.svg $(IMG_DIR) inkscape -o $@ $< .PHONY: clean debug install tests imgs clean: rm -rf $(BUILDDIR) debug: go run -race $(LIMOX_GO_PACKAGE) install: $(LIMOX) install -Dm 755 $(LIMOX) $(LIMOX_INSTALL) install -Dm 644 $(DESKTOP) $(DESKTOP_INSTALL) tests: go test -test.v $(LIMOX_GO_PACKAGE)/... imgs: $(IMGS)