From c43c14fb19bf1fa17c191628a95cc298868e90e6 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Tue, 24 Dec 2024 11:04:48 +0100 Subject: [PATCH] Add Makefile which installs everything --- Makefile | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ae2ba58 --- /dev/null +++ b/Makefile @@ -0,0 +1,61 @@ +PREFIX ?= $(HOME)/.local +BINDIR := $(PREFIX)/bin +MANDIR := $(PREFIX)/man/man1 +DATADIR := $(PREFIX)/share/mkproj +TESTSDIR := $(DATADIR)/tests +TESTSSRCDIR := $(TESTSDIR)/src + +TPLS := $(addprefix $(DATADIR)/, $(notdir $(wildcard tpl/*))) +TESTFILES := $(addprefix $(TESTSDIR)/, $(notdir $(wildcard tpl/tests/*))) +TESTSRCFILES := $(addprefix $(TESTSSRCDIR)/, $(notdir $(wildcard tpl/tests/src/*))) + +.PHONY: all + +all: \ +$(BINDIR) \ +$(MANDIR) \ +$(DATADIR) \ +$(TESTSDIR) \ +$(TESTSSRCDIR) \ +$(BINDIR)/mkproj \ +$(MANDIR)/mkproj.1 \ +$(TPLS) \ +$(TESTFILES) \ +$(TESTSRCFILES) \ +$(HOME)/.config/mkprojrc + +$(BINDIR): + mkdir -p $@ + @printf "\e[m33%s\n\e[m" "Please make sure that $(BINDIR) is in your path." + +$(BINDIR)/mkproj: mkproj.sh + install -m 0755 $< $@ + +$(MANDIR): + mkdir -p $@ + +$(MANDIR)/mkproj.1: mkproj.1 + install -m 0644 $< $@ + +$(DATADIR): + mkdir -p $@ + +$(DATADIR)/%: tpl/% + install -m 0644 $< $@ + +$(TESTSDIR): + mkdir -p $@ + cd $(TESTSDIR) && ln -s ../Makefile Makefile + +$(TESTSSRCDIR): + mkdir -p $@ + cd $(TESTSSRCDIR) && ln -s ../../src/precomp.hpp precomp.hpp + +$(TESTSDIR)/%: tpl/tests/% + install -m 0644 $< $@ + +$(TESTSSRCDIR)/%: tpl/tests/src/% + install -m 0644 $< $@ + +$(HOME)/.config/mkprojrc: + echo $(DATADIR) > $@