Comparison

Makefile @ 7682:e07116c0df77

Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
author Kim Alvefur <zash@zash.se>
date Sat, 01 Oct 2016 01:46:43 +0200
parent 7681:2f2f93661d8b
child 7683:7356bf4425f4
comparison
equal deleted inserted replaced
7681:2f2f93661d8b 7682:e07116c0df77
11 INSTALLEDSOURCE = $(LIBDIR)/prosody 11 INSTALLEDSOURCE = $(LIBDIR)/prosody
12 INSTALLEDCONFIG = $(SYSCONFDIR) 12 INSTALLEDCONFIG = $(SYSCONFDIR)
13 INSTALLEDMODULES = $(LIBDIR)/prosody/modules 13 INSTALLEDMODULES = $(LIBDIR)/prosody/modules
14 INSTALLEDDATA = $(DATADIR) 14 INSTALLEDDATA = $(DATADIR)
15 15
16 INSTALL=install
17 INSTALL_DATA=$(INSTALL) -m644
18 INSTALL_EXEC=$(INSTALL) -m755
19 MKDIR=install -d
20 MKDIR_PRIVATE=$(MKDIR) -m750
21
16 .PHONY: all clean install 22 .PHONY: all clean install
17 23
18 all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version 24 all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version
19 $(MAKE) -C util-src install 25 $(MAKE) -C util-src install
20 ifeq ($(EXCERTS),yes) 26 ifeq ($(EXCERTS),yes)
21 -$(MAKE) -C certs localhost.crt example.com.crt 27 -$(MAKE) -C certs localhost.crt example.com.crt
22 endif 28 endif
23 29
24 install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so 30 install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so
25 install -d $(BIN) $(CONFIG) $(MODULES) $(SOURCE) 31 $(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
26 install -m750 -d $(DATA) 32 $(MKDIR_PRIVATE) $(DATA)
27 install -d $(MAN)/man1 33 $(MKDIR) $(MAN)/man1
28 install -d $(CONFIG)/certs 34 $(MKDIR) $(CONFIG)/certs
29 install -d $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util 35 $(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
30 install -m755 ./prosody.install $(BIN)/prosody 36 $(INSTALL_EXEC) ./prosody.install $(BIN)/prosody
31 install -m755 ./prosodyctl.install $(BIN)/prosodyctl 37 $(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl
32 install -m644 core/*.lua $(SOURCE)/core 38 $(INSTALL_DATA) core/*.lua $(SOURCE)/core
33 install -m644 net/*.lua $(SOURCE)/net 39 $(INSTALL_DATA) net/*.lua $(SOURCE)/net
34 install -d $(SOURCE)/net/http $(SOURCE)/net/websocket 40 $(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/websocket
35 install -m644 net/http/*.lua $(SOURCE)/net/http 41 $(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http
36 install -m644 net/websocket/*.lua $(SOURCE)/net/websocket 42 $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket
37 install -m644 util/*.lua $(SOURCE)/util 43 $(INSTALL_DATA) util/*.lua $(SOURCE)/util
38 install -m644 util/*.so $(SOURCE)/util 44 $(INSTALL_DATA) util/*.so $(SOURCE)/util
39 install -d $(SOURCE)/util/sasl 45 $(MKDIR) $(SOURCE)/util/sasl
40 install -m644 util/sasl/*.lua $(SOURCE)/util/sasl 46 $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl
41 install -d $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc 47 $(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc
42 install -m644 plugins/*.lua $(MODULES) 48 $(INSTALL_DATA) plugins/*.lua $(MODULES)
43 install -m644 plugins/mod_s2s/*.lua $(MODULES) 49 $(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)
44 install -m644 plugins/mod_pubsub/*.lua $(MODULES) 50 $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)
45 install -m644 plugins/adhoc/*.lua $(MODULES) 51 $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)
46 install -m644 plugins/muc/*.lua $(MODULES) 52 $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)
47 install -m644 certs/* $(CONFIG)/certs 53 $(INSTALL_DATA) certs/* $(CONFIG)/certs
48 install -m644 man/prosodyctl.man $(MAN)/man1/prosodyctl.1 54 $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1
49 test -f $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua 55 test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
50 -test -f prosody.version && install -m644 prosody.version $(SOURCE)/prosody.version 56 -test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version
51 $(MAKE) install -C util-src 57 $(MAKE) install -C util-src
52 58
53 clean: 59 clean:
54 rm -f prosody.install 60 rm -f prosody.install
55 rm -f prosodyctl.install 61 rm -f prosodyctl.install