-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile_client
71 lines (59 loc) · 2.22 KB
/
Makefile_client
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
SHELL = /bin/ksh
COMMON = ../install/common
QACOMMENT = -comment cmrs=qa
PYTHON_DEFAULT = /usr/bin/env python
PYTHON_CLIENT_PROD = /ms/dist/python/PROJ/core/3.10.11-0/exec/bin/python -E
PYTHON_SERVER_PROD = /ms/dist/python/PROJ/core/3.10.11-0/exec/bin/python -E
MPR := $(shell echo $(PWD) | awk -F/ '{print $$(NF-3), $$(NF-2), $$(NF-1)}')
META = $(word 1,$(MPR))
PROJ = $(word 2,$(MPR))
REL = $(word 3,$(MPR))
NON_AQ6_HOST := $(findstring 6., $(shell egrep '\s6\.[0-9]+' /etc/redhat-release))
ifneq (aquilon,$(META))
META = aquilon
PROJ = aqd
REL := $(shell git describe | awk -F- '{print $$1}')
endif
# determine if we're in /ms/dev or our shadow
# keep them owner writeable in shadow install
PERMS = 755
LIB_PERMS = 644
IN_AFS = $(findstring /ms/dev/aquilon/aqd, $(PWD))
ifneq (,$(IN_AFS))
COMMON = /ms/dev/aquilon/aqd/$(REL)/install/common
PERMS = 555
LIB_PERMS = 444
endif
#try make print-LIB_DIRS for an example
#IF YOU WANT THE FILE DEFINED FROM, ADD (from $(origin $*))
print-%: ; @$(error $* is $($*) ($(value $*)))
BIN_FILES := $(shell find bin -type f | sed -e 's/.py$$//')
FILES = $(BIN_FILES)
INSTALLFILES = $(addprefix $(COMMON)/,$(FILES))
# Here, we make some very easy to parse, and perhaps not very subtle,
# The goal is to be readable by someone who doesn't know make very well,
# to make it maintainable, not to impress you with how well I know the tool
#rm -r $(COMMON)/bin/aq $(COMMON)/bin/aq_compile $(COMMON)/bin/aqd_config
$(COMMON)/bin/aq: bin/aq.py
@mkdir -p `dirname $@`
sed -e '1s,^#!$(PYTHON_DEFAULT)\(.*\),#!$(PYTHON_CLIENT_PROD)\1,' <$< >$@
chmod $(PERMS) $@
$(COMMON)/bin/aq_compile: bin/aq_compile.py
@mkdir -p `dirname $@`
sed -e '1s,^#!$(PYTHON_DEFAULT)\(.*\),#!$(PYTHON_CLIENT_PROD)\1,' <$< >$@
chmod $(PERMS) $@
$(COMMON)/bin/aqd_config: bin/aqd_config.py
@mkdir -p `dirname $@`
sed -e '1s,^#!$(PYTHON_DEFAULT)\(.*\),#!$(PYTHON_CLIENT_PROD)\1,' <$< >$@
chmod $(PERMS) $@
.PHONY: install
install: remove_stale $(INSTALLFILES)
.PHONY: remove_stale
remove_stale:
$(PYTHON_CLIENT_PROD) ./tools/remove_stale.py "$(COMMON)/bin"
.PHONY: clean
clean:
$(MAKE) -C doc clean
find . -name '*.pyc' -exec rm -rf {} \;
# This needs to be fixed
# find * -type d -empty -exec rmdir {} \;