annotate misc/Makefile @ 619:06d957e2cdce

Port Makefile to Solaris.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Thu, 02 Jun 2016 22:48:05 +0300
parents 41c5dab96724
children df21e61d2343
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
225
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
1 SHELL = /bin/sh
156
f19900f84977 Warn if /home/sasha and prefix are not set.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 155
diff changeset
2
348
f742a1651d21 Added standard settings for GNU Make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 328
diff changeset
3 # Disable built in pattern rules.
f742a1651d21 Added standard settings for GNU Make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 328
diff changeset
4 MAKEFLAGS += -r
f742a1651d21 Added standard settings for GNU Make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 328
diff changeset
5 # Disable built in variables.
f742a1651d21 Added standard settings for GNU Make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 328
diff changeset
6 MAKEFLAGS += -R
f742a1651d21 Added standard settings for GNU Make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 328
diff changeset
7 # Disable built in suffix rules.
f742a1651d21 Added standard settings for GNU Make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 328
diff changeset
8 .SUFFIXES:
549
41c5dab96724 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 406
diff changeset
9 # Delete target file if command fails.
41c5dab96724 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 406
diff changeset
10 .DELETE_ON_ERROR:
348
f742a1651d21 Added standard settings for GNU Make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 328
diff changeset
11 # Default target.
252
dfd36c4c18c7 .DEFAULT_GOAL set to 'all'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 225
diff changeset
12 .DEFAULT_GOAL = all
dfd36c4c18c7 .DEFAULT_GOAL set to 'all'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 225
diff changeset
13
619
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
14 ################################################################
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
15 # Platform definition.
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
16
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
17 uname-s := $(shell uname -s)
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
18
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
19 build_os = unix
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
20 ifneq '' '$(filter MINGW%,$(uname-s))'
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
21 build_os = mingw
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
22 endif
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
23 ifneq '' '$(filter CYGWIN%,$(uname-s))'
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
24 build_os = cygwin
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
25 endif
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
26 ifeq 'SunOS' '$(uname-s)'
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
27 build_os = solaris
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
28 endif
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
29
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
30 ################################################################
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
31 # Path definitions.
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
32
225
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
33 ifeq '' '$(prefix)'
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
34 ifneq '' '$(HOME)'
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
35 prefix = $(HOME)/usr
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
36 else
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
37 $(error HOME env var and prefix var are not set!)
156
f19900f84977 Warn if /home/sasha and prefix are not set.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 155
diff changeset
38 endif
f19900f84977 Warn if /home/sasha and prefix are not set.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 155
diff changeset
39 endif
115
cede023f83f6 Added to build hg proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
40
155
25a56046e0e4 Use standard var names in makefiles like prefix, bindir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 142
diff changeset
41 bindir = $(prefix)/bin
115
cede023f83f6 Added to build hg proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
42
619
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
43 ################################################################
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
44 # Build toolchain definitions.
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
45
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
46 INSTALL_PROGRAM := install -m 755
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
47 INSTALL_DATA := install -m 644
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
48 ifeq 'solaris' '$(build_os)'
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
49 INSTALL_PROGRAM := ginstall -m 755
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
50 INSTALL_DATA := ginstall -m 644
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
51 endif
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
52
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
53 ################################################################
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
54 # Files definitions.
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
55
406
c22f35ecdb92 my-ascii.sh
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 348
diff changeset
56 FILES = trac-digest.sh find-ext.sh line-count.sh $(wildcard cleanupdoc-*.sh) mymake.sh my-ascii.sh
269
108007787078 Install files from list of files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 257
diff changeset
57
619
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
58 ################################################################
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
59 # Build targets.
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
60
225
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
61 .PHONY: all
115
cede023f83f6 Added to build hg proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
62 all:
cede023f83f6 Added to build hg proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
63
225
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
64 .PHONY: check
118
bd4661bc791d Added default "all" and check, clean target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 116
diff changeset
65 check:
bd4661bc791d Added default "all" and check, clean target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 116
diff changeset
66
225
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
67 .PHONY: install
115
cede023f83f6 Added to build hg proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
68 install:
155
25a56046e0e4 Use standard var names in makefiles like prefix, bindir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 142
diff changeset
69 [ -d $(bindir) ] || mkdir -p $(bindir)
269
108007787078 Install files from list of files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 257
diff changeset
70 for file in $(FILES); do \
108007787078 Install files from list of files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 257
diff changeset
71 filenoext=$${file%.sh}; \
108007787078 Install files from list of files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 257
diff changeset
72 filenoext=$${filenoext%.py}; \
619
06d957e2cdce Port Makefile to Solaris.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
73 $(INSTALL_PROGRAM) $$file $(bindir)/$$filenoext; \
269
108007787078 Install files from list of files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 257
diff changeset
74 done
115
cede023f83f6 Added to build hg proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
75
225
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
76 .PHONY: uninstall
115
cede023f83f6 Added to build hg proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
77 uninstall:
270
7899d9bdd4a8 Automatic remove file from list of files on 'uninstall'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 269
diff changeset
78 for file in $(FILES); do \
7899d9bdd4a8 Automatic remove file from list of files on 'uninstall'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 269
diff changeset
79 filenoext=$${file%.sh}; \
7899d9bdd4a8 Automatic remove file from list of files on 'uninstall'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 269
diff changeset
80 filenoext=$${filenoext%.py}; \
7899d9bdd4a8 Automatic remove file from list of files on 'uninstall'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 269
diff changeset
81 [ -e $(bindir)/$$file ] && if rm $(bindir)/$$file; then :; else echo Unable to delete $(bindir)/$$file; exit 1; fi || :; \
7899d9bdd4a8 Automatic remove file from list of files on 'uninstall'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 269
diff changeset
82 [ -e $(bindir)/$$filenoext ] && if rm $(bindir)/$$filenoext; then :; else echo Unable to delete $(bindir)/$$filenoext; exit 1; fi || :; \
142
daca3130406a Update build script to satisfy build policy about DESTDIR.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents: 130
diff changeset
83 done
225
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
84
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
85 .PHONY: distclean
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
86 distclean: clean
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
87
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
88 .PHONY: clean
cf0a9dff99ed Fix warn case for prefix and HOME variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 156
diff changeset
89 clean: