Comparison

makefile @ 8593:c4222e36333c

Add makefiles compatible with BSD make
author Kim Alvefur <zash@zash.se>
date Sun, 11 Mar 2018 06:01:19 +0100
child 9682:814a9d89d2bd
child 11748:88ba05494d17
comparison
equal deleted inserted replaced
8592:bd4f8a2b72c7 8593:c4222e36333c
1
2 include config.unix
3
4 BIN = $(DESTDIR)$(PREFIX)/bin
5 CONFIG = $(DESTDIR)$(SYSCONFDIR)
6 MODULES = $(DESTDIR)$(LIBDIR)/prosody/modules
7 SOURCE = $(DESTDIR)$(LIBDIR)/prosody
8 DATA = $(DESTDIR)$(DATADIR)
9 MAN = $(DESTDIR)$(PREFIX)/share/man
10
11 INSTALLEDSOURCE = $(LIBDIR)/prosody
12 INSTALLEDCONFIG = $(SYSCONFDIR)
13 INSTALLEDMODULES = $(LIBDIR)/prosody/modules
14 INSTALLEDDATA = $(DATADIR)
15
16 INSTALL=install -p
17 INSTALL_DATA=$(INSTALL) -m644
18 INSTALL_EXEC=$(INSTALL) -m755
19 MKDIR=install -d
20 MKDIR_PRIVATE=$(MKDIR) -m750
21
22 .PHONY: all test clean install
23
24 all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version
25 $(MAKE) -C util-src install
26 .if $(EXCERTS) == "yes"
27 $(MAKE) -C certs localhost.crt example.com.crt
28 .endif
29
30 install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so
31 $(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
32 $(MKDIR_PRIVATE) $(DATA)
33 $(MKDIR) $(MAN)/man1
34 $(MKDIR) $(CONFIG)/certs
35 $(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
36 $(INSTALL_EXEC) ./prosody.install $(BIN)/prosody
37 $(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl
38 $(INSTALL_DATA) core/*.lua $(SOURCE)/core
39 $(INSTALL_DATA) net/*.lua $(SOURCE)/net
40 $(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/resolvers $(SOURCE)/net/websocket
41 $(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http
42 $(INSTALL_DATA) net/resolvers/*.lua $(SOURCE)/net/resolvers
43 $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket
44 $(INSTALL_DATA) util/*.lua $(SOURCE)/util
45 $(INSTALL_DATA) util/*.so $(SOURCE)/util
46 $(MKDIR) $(SOURCE)/util/sasl
47 $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl
48 $(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc $(MODULES)/mod_mam
49 $(INSTALL_DATA) plugins/*.lua $(MODULES)
50 $(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)/mod_s2s
51 $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)/mod_pubsub
52 $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)/adhoc
53 $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)/muc
54 $(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam
55 .if $(EXCERTS) == "yes"
56 $(INSTALL_DATA) certs/localhost.crt certs/localhost.key $(CONFIG)/certs
57 $(INSTALL_DATA) certs/example.com.crt certs/example.com.key $(CONFIG)/certs
58 .endif
59 $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1
60 test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
61 -test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version
62 $(MAKE) install -C util-src
63
64 clean:
65 rm -f prosody.install
66 rm -f prosodyctl.install
67 rm -f prosody.cfg.lua.install
68 rm -f prosody.version
69 $(MAKE) clean -C util-src
70
71 test:
72 busted --lua=$(RUNWITH)
73
74
75 prosody.install: prosody
76 sed "1s| lua$$| $(RUNWITH)|; \
77 s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
78 s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \
79 s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \
80 s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < prosody > $@
81
82 prosodyctl.install: prosodyctl
83 sed "1s| lua$$| $(RUNWITH)|; \
84 s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
85 s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \
86 s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \
87 s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < prosodyctl > $@
88
89 prosody.cfg.lua.install: prosody.cfg.lua.dist
90 sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' prosody.cfg.lua.dist > $@
91
92 prosody.version:
93 test -f prosody.release && \
94 cp prosody.release $@ || \
95 test -f .hg_archival.txt && \
96 sed -n 's/^node: \(............\).*/\1/p' .hg_archival.txt > $@ || \
97 test -f .hg/dirstate && \
98 hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@ || \
99 echo unknown > $@
100
101