mkproj/Makefile

62 lines
1.2 KiB
Makefile

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) > $@