-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (67 loc) · 2.06 KB
/
Copy pathMakefile
File metadata and controls
79 lines (67 loc) · 2.06 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
#
#! \file ~/Makefile
#! \author Jiří Kučera, <sanczes AT gmail.com>
#! \stamp 2018-09-23 11:43:05 +0200
#! \project mkutils - Makefile Utilities
#! \license MIT
#! \version 0.0.0
#! \brief Makefile.
#
include $(CURDIR)/mkutils.mk
NAME = $(__mkutils_name__)
INCFILE := $(NAME).mk
$(call AddToolX, chmod)
$(call AddToolX, mkdir)
$(call AddToolX, cat)
$(call AddTool, sed)
$(call AddVarX, prefix=PATH, /usr/local, \
specify installation prefix of installed or to be /n \
installed files and directories, \
install uninstall \
)
$(call DefVarX, bindir=PATH, $$(prefix)/bin, \
specify where to install binaries or where the /n \
binaries are installed, \
install uninstall \
)
$(call DefVarX, includedir=PATH, $$(prefix)/include, \
specify where to install $(INCFILE) or where the /n \
$(INCFILE) is installed, \
install uninstall \
)
$(call AddVar, DEST=PATH, $$(CURDIR), \
specify where to copy $(INCFILE), \
bundle \
)
$(call DefaultTarget, help)
$(call SetVarX, INCDIR, $$(includedir)/$$(NAME))
$(call SetVarX, INCPATH, $$(INCDIR)/$$(INCFILE))
$(call SetVarX, BUNDLESCRIPTFILE, $$(NAME)-bundle)
$(call SetVarX, BUNDLESCRIPTPATH, $$(bindir)/$$(BUNDLESCRIPTFILE))
EDIT := $(SED) -f $(CURDIR)/striptilde.sed
$(call TargetX, install, install $(NAME))
$(MKDIR) -p $(INCDIR)
$(EDIT) $(CURDIR)/$(INCFILE) > $(INCPATH)
$(CHMOD) 644 $(INCPATH)
$(CAT) $(CURDIR)/$(BUNDLESCRIPTFILE).in \
| $(SED) -e $(SHQ)s,@INCFILE@,$(INCFILE),g$(SHQ) \
-e $(SHQ)s,@INCPATH@,$(INCPATH),g$(SHQ) \
> $(BUNDLESCRIPTPATH)
$(CHMOD) 755 $(BUNDLESCRIPTPATH)
$(call TargetX, uninstall, uninstall $(NAME))
$(RM) -rfd $(INCDIR)
$(RM) -f $(BUNDLESCRIPTPATH)
$(call Target, bundle, \
bundle $(NAME) to an existing project; /n \
$(INCFILE) is copied and edited to the /n \
location specified by DEST \
)
ifeq ($(DEST),$(CURDIR))
@$(ECHO) "Please set DEST to be not the source location."
@$(FALSE)
else
$(EDIT) $(CURDIR)/$(INCFILE) > $(DEST)/$(INCFILE)
endif
$(call Target, test, run the test suite)
$(MAKE) -f $(CURDIR)/tests.mk
$(call GenerateHelp)