Add Makefile which installs everything
This commit is contained in:
parent
111ad3c2be
commit
c43c14fb19
61
Makefile
Normal file
61
Makefile
Normal file
@ -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) > $@
|
Loading…
x
Reference in New Issue
Block a user