73 lines
1.4 KiB
Makefile
73 lines
1.4 KiB
Makefile
# Override PREFIX for another root installation directory
|
|
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/*)))
|
|
|
|
# Pattern rules
|
|
|
|
$(DATADIR)/%: tpl/%
|
|
install -m 0644 $< $@
|
|
|
|
$(TESTSDIR)/%: tpl/tests/%
|
|
install -m 0644 $< $@
|
|
|
|
$(TESTSSRCDIR)/%: tpl/tests/src/%
|
|
install -m 0644 $< $@
|
|
|
|
# Targets
|
|
|
|
.PHONY: all
|
|
|
|
all: \
|
|
$(BINDIR) \
|
|
$(MANDIR) \
|
|
$(DATADIR) \
|
|
$(TESTSDIR) \
|
|
$(TESTSSRCDIR) \
|
|
$(BINDIR)/mkproj \
|
|
$(MANDIR)/mkproj.1 \
|
|
$(TPLS) \
|
|
$(TESTFILES) \
|
|
$(TESTSDIR)/Makefile \
|
|
$(TESTSRCFILES) \
|
|
$(TESTSSRCDIR)/src/precomp.hpp \
|
|
$(HOME)/.config/mkprojrc
|
|
|
|
$(BINDIR):
|
|
mkdir -p $@
|
|
@printf "\e[33m%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 $@
|
|
|
|
$(TESTSDIR):
|
|
mkdir -p $@
|
|
|
|
$(TESTSDIR)/Makefile:
|
|
cd $(TESTSDIR) && ln -fs ../Makefile Makefile
|
|
|
|
$(TESTSSRCDIR):
|
|
mkdir -p $@
|
|
|
|
$(TESTSSRCDIR)/src/precomp.hpp:
|
|
cd $(TESTSSRCDIR) && ln -fs ../../src/precomp.hpp precomp.hpp
|
|
|
|
$(HOME)/.config/mkprojrc:
|
|
echo "tplroot=\"$(DATADIR)\"" > $@
|