Makefile
author Matthew Wild <mwild1@gmail.com>
Wed, 27 Sep 2017 15:49:41 +0100
changeset 8289 39966cbc29f4
parent 7882 5d0175d3ecf4
child 8241 1339d7ed54d5
permissions -rw-r--r--
CHANGES: Update for release
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     1
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     2
include config.unix
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     3
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     4
BIN = $(DESTDIR)$(PREFIX)/bin
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     5
CONFIG = $(DESTDIR)$(SYSCONFDIR)
6577
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 6044
diff changeset
     6
MODULES = $(DESTDIR)$(LIBDIR)/prosody/modules
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 6044
diff changeset
     7
SOURCE = $(DESTDIR)$(LIBDIR)/prosody
503
00702b66beb1 Makefile fix for creating datadir in correct place on install
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
     8
DATA = $(DESTDIR)$(DATADIR)
1464
047ed6e52a41 Added man page for prosodyctl
Dwayne Bent <dbb.0@liqd.org>
parents: 1454
diff changeset
     9
MAN = $(DESTDIR)$(PREFIX)/share/man
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 501
diff changeset
    10
6577
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 6044
diff changeset
    11
INSTALLEDSOURCE = $(LIBDIR)/prosody
480
5d00d623904e Update Makefile to set correct paths on install with Debian package
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
    12
INSTALLEDCONFIG = $(SYSCONFDIR)
6577
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 6044
diff changeset
    13
INSTALLEDMODULES = $(LIBDIR)/prosody/modules
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 501
diff changeset
    14
INSTALLEDDATA = $(DATADIR)
480
5d00d623904e Update Makefile to set correct paths on install with Debian package
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
    15
7686
7356bf4425f4 Makefile: Preserve timestamps of installed files (fixes #547)
Kim Alvefur <zash@zash.se>
parents: 7685
diff changeset
    16
INSTALL=install -p
7685
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    17
INSTALL_DATA=$(INSTALL) -m644
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    18
INSTALL_EXEC=$(INSTALL) -m755
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    19
MKDIR=install -d
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    20
MKDIR_PRIVATE=$(MKDIR) -m750
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    21
7793
0310ab4f277f Makefile: Add 'test' to phony targets so `make test` runs tests even if a file 'test' exists
Kim Alvefur <zash@zash.se>
parents: 7692
diff changeset
    22
.PHONY: all test clean install
4396
03b59a511671 Makefile, util-src/Makefile: Add .PHONY, reorganise util-src/Makefile
Matthew Wild <mwild1@gmail.com>
parents: 3266
diff changeset
    23
1310
b5a7a9fc9161 Makefile: Experimental support for recording the version of an installed Prosody
Matthew Wild <mwild1@gmail.com>
parents: 1300
diff changeset
    24
all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version
586
b828d7d47973 Add posix support library, and adjust makefiles for it
Matthew Wild <mwild1@gmail.com>
parents: 514
diff changeset
    25
	$(MAKE) -C util-src install
5933
56b1f151f4a3 Makefile, configure: Add option for disabling generation of example certificates
Kim Alvefur <zash@zash.se>
parents: 5924
diff changeset
    26
ifeq ($(EXCERTS),yes)
6888
07078f762061 Makefile: Use hypen to tell Make when to ignore errors
Kim Alvefur <zash@zash.se>
parents: 6887
diff changeset
    27
	-$(MAKE) -C certs localhost.crt example.com.crt
5933
56b1f151f4a3 Makefile, configure: Add option for disabling generation of example certificates
Kim Alvefur <zash@zash.se>
parents: 5924
diff changeset
    28
endif
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    29
1090
e47310ca513b Makefile: Process and install prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 993
diff changeset
    30
install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so
7685
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    31
	$(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    32
	$(MKDIR_PRIVATE) $(DATA)
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    33
	$(MKDIR) $(MAN)/man1
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    34
	$(MKDIR) $(CONFIG)/certs
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    35
	$(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    36
	$(INSTALL_EXEC) ./prosody.install $(BIN)/prosody
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    37
	$(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    38
	$(INSTALL_DATA) core/*.lua $(SOURCE)/core
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    39
	$(INSTALL_DATA) net/*.lua $(SOURCE)/net
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    40
	$(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/websocket
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    41
	$(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    42
	$(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    43
	$(INSTALL_DATA) util/*.lua $(SOURCE)/util
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    44
	$(INSTALL_DATA) util/*.so $(SOURCE)/util
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    45
	$(MKDIR) $(SOURCE)/util/sasl
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    46
	$(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl
7882
5d0175d3ecf4 Makefile: Install mod_mam (fixes #825)
Kim Alvefur <zash@zash.se>
parents: 7793
diff changeset
    47
	$(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc $(MODULES)/mod_mam
7685
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    48
	$(INSTALL_DATA) plugins/*.lua $(MODULES)
7692
97c013e8f002 Makefile: Fix installing modules into their correct subdirectories (thanks mimi89999)
Kim Alvefur <zash@zash.se>
parents: 7686
diff changeset
    49
	$(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)/mod_s2s
97c013e8f002 Makefile: Fix installing modules into their correct subdirectories (thanks mimi89999)
Kim Alvefur <zash@zash.se>
parents: 7686
diff changeset
    50
	$(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)/mod_pubsub
97c013e8f002 Makefile: Fix installing modules into their correct subdirectories (thanks mimi89999)
Kim Alvefur <zash@zash.se>
parents: 7686
diff changeset
    51
	$(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)/adhoc
97c013e8f002 Makefile: Fix installing modules into their correct subdirectories (thanks mimi89999)
Kim Alvefur <zash@zash.se>
parents: 7686
diff changeset
    52
	$(INSTALL_DATA) plugins/muc/*.lua $(MODULES)/muc
7882
5d0175d3ecf4 Makefile: Install mod_mam (fixes #825)
Kim Alvefur <zash@zash.se>
parents: 7793
diff changeset
    53
	$(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam
7685
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    54
	$(INSTALL_DATA) certs/* $(CONFIG)/certs
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    55
	$(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    56
	test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
e07116c0df77 Makefile: Refactor all uses of the install command with variables, allowing them to be overridden
Kim Alvefur <zash@zash.se>
parents: 7684
diff changeset
    57
	-test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    58
	$(MAKE) install -C util-src
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    59
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    60
clean:
467
66f145f5c932 Update Makefile to now pass config paths to prosody. Update prosody, modulemanager and connectionlisteners to obey these paths.
Matthew Wild <mwild1@gmail.com>
parents: 465
diff changeset
    61
	rm -f prosody.install
1090
e47310ca513b Makefile: Process and install prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 993
diff changeset
    62
	rm -f prosodyctl.install
492
279f64370885 Don't write to prosody.cfg.lua from Makefile. Much apologies to poor albert :(
Matthew Wild <mwild1@gmail.com>
parents: 481
diff changeset
    63
	rm -f prosody.cfg.lua.install
1310
b5a7a9fc9161 Makefile: Experimental support for recording the version of an installed Prosody
Matthew Wild <mwild1@gmail.com>
parents: 1300
diff changeset
    64
	rm -f prosody.version
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    65
	$(MAKE) clean -C util-src
464
f1827353fd58 More Makefile improvements
Matthew Wild <mwild1@gmail.com>
parents: 463
diff changeset
    66
7074
d9e620adfb64 Makefile: Add 'test' target that runs tests
Kim Alvefur <zash@zash.se>
parents: 6910
diff changeset
    67
test:
7237
161f9f163e37 Makefile: Reduce verbosity of 'make test' so it only shows test failures
Matthew Wild <mwild1@gmail.com>
parents: 7168
diff changeset
    68
	cd tests && $(RUNWITH) test.lua 0
7240
472736b583fb tests: Add extra tests for util.json
Matthew Wild <mwild1@gmail.com>
parents: 7237
diff changeset
    69
	# Skipping: cd tests && RUNWITH=$(RUNWITH) ./test_util_json.sh
7074
d9e620adfb64 Makefile: Add 'test' target that runs tests
Kim Alvefur <zash@zash.se>
parents: 6910
diff changeset
    70
4402
05f8826972ba Makefile: Merge identical rules and some other improvements.
Kim Alvefur <zash@zash.se>
parents: 4396
diff changeset
    71
util/%.so:
464
f1827353fd58 More Makefile improvements
Matthew Wild <mwild1@gmail.com>
parents: 463
diff changeset
    72
	$(MAKE) install -C util-src
467
66f145f5c932 Update Makefile to now pass config paths to prosody. Update prosody, modulemanager and connectionlisteners to obey these paths.
Matthew Wild <mwild1@gmail.com>
parents: 465
diff changeset
    73
4402
05f8826972ba Makefile: Merge identical rules and some other improvements.
Kim Alvefur <zash@zash.se>
parents: 4396
diff changeset
    74
%.install: %
6044
1ce05d38d1bb Makefile: Change sed regex to be compatible with FreeBSD's odd sed, and change / to | to allow paths to be used in RUNWITH (thanks Ben)
Matthew Wild <mwild1@gmail.com>
parents: 5933
diff changeset
    75
	sed "1s| lua$$| $(RUNWITH)|; \
5145
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 4686
diff changeset
    76
		s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
514
03d7da01843e Change sed usage back into one sed script for incompetent versions of sed
Matthew Wild <mwild1@gmail.com>
parents: 512
diff changeset
    77
		s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \
03d7da01843e Change sed usage back into one sed script for incompetent versions of sed
Matthew Wild <mwild1@gmail.com>
parents: 512
diff changeset
    78
		s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \
4402
05f8826972ba Makefile: Merge identical rules and some other improvements.
Kim Alvefur <zash@zash.se>
parents: 4396
diff changeset
    79
		s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < $^ > $@
467
66f145f5c932 Update Makefile to now pass config paths to prosody. Update prosody, modulemanager and connectionlisteners to obey these paths.
Matthew Wild <mwild1@gmail.com>
parents: 465
diff changeset
    80
4402
05f8826972ba Makefile: Merge identical rules and some other improvements.
Kim Alvefur <zash@zash.se>
parents: 4396
diff changeset
    81
prosody.cfg.lua.install: prosody.cfg.lua.dist
05f8826972ba Makefile: Merge identical rules and some other improvements.
Kim Alvefur <zash@zash.se>
parents: 4396
diff changeset
    82
	sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' $^ > $@
1090
e47310ca513b Makefile: Process and install prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 993
diff changeset
    83
6886
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    84
%.version: %.release
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    85
	cp $^ $@
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    86
6887
e32275ed5632 Makefile: Support generating prosody.version from hg archive metadata file
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
    87
%.version: .hg_archival.txt
e32275ed5632 Makefile: Support generating prosody.version from hg archive metadata file
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
    88
	sed -n 's/^node: \(............\).*/\1/p' $^ > $@
e32275ed5632 Makefile: Support generating prosody.version from hg archive metadata file
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
    89
6886
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    90
%.version: .hg/dirstate
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    91
	hexdump -n6 -e'6/1 "%02x"' $^ > $@
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    92
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    93
%.version:
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    94
	echo unknown > $@
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    95
954a8a8c46d6 Makefile: Simplify generation of prosody.version using magic Make magic
Kim Alvefur <zash@zash.se>
parents: 6843
diff changeset
    96