-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (81 loc) · 2.48 KB
/
Makefile
File metadata and controls
119 lines (81 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Id: mkdoc/0.0.2-test+20150804-0404 Makefile
BUILD := .build/
# some variants on CURDIR:
DIR := .
BASE := $(shell cd $(DIR);pwd)
HOST := $(shell hostname -s | tr 'A-Z' 'a-z' | tr '.' '-')
ENV_NAME ?= $(shell [ -n "$$ENV_NAME" ] && echo $$ENV_NAME || echo development)
#ID := mkdoc/0.0.1-master
PROJECT := mkdoc
VERSION := 0.0.2-test+20150804-0404# mkdoc
# CURDIR and MAKEFILE_LIST are GNU Make internals
location = $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
# Global list of all makefiles
MK := $(location)
#MK += $(DIR)/Makefile
BASE := $(shell cd $(DIR);pwd)
relative = $(patsubst $(BASE)%,$(PROJECT):%,$1)
where-am-i = $(call relative,$(lastword $(MAKEFILE_LIST)))
# BSD weirdness
echo = /bin/echo
# ------------ --
## Make internals
# make include search path
VPATH := . /
# make shell
SHELL := /bin/bash
# reset file extensions
# XXX: for imlicit rules?
.SUFFIXES:
#.SUFFIXES: .rst .js .xhtml .mk .tex .pdf .list
.SUFFIXES: .rst .mk
# ------------ --
## Local setup
# name default target, dont set deps yet
default::
# preset DEFAULT based on environment/goals
include Makefile.default-goals
# global path/file lists
SRC :=
DMK :=
#already setMK :=
DEP :=
TRGT :=
STRGT := default usage stat build test install check clean info
CLN :=
TEST :=
INSTALL :=
ll = ./usr/share/mkdoc/Core/log.sh
# rules: return Rules files for each directory in $1
RULE_PREFIX := ./ .
rules = $(foreach D,$1,\
$(foreach P,$(RULE_PREFIX), \
$(wildcard \
$D$PRules.mk \
$D$PRules.shared.mk $D$PRules.*.shared.mk \
$D$PRules.$(PROJECT).mk \
$D$PRules.$(HOST).mk \
)))
# Include all local rules files
#
include $(call rules,$(DIR)/)
# pseudo targets are not files, don't check with OS
.PHONY: $(STRGT)
DEFAULT ?= usage
# ------------ --
## Main rules/deps
default:: $(DMK) $(DEP)
default:: $(DEFAULT)
usage::
@echo 'set ENV_NAME to [development|testing|production] for other default behaviour'
stat:: $(SRC)
build:: $(TRGT)
test:: $(TEST)
install:: $(INSTALL)
check::
clean:: .
rm -rf $(CLN)
info::
@echo "Id: $(PROJECT)/$(VERSION)"
@echo "Name: $(PROJECT)"
@echo "Version: $(VERSION)"