From e156c05ad42fdf522a3421ff98e5eb961ac6df41 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 31 Oct 2017 17:28:23 +0100 Subject: Rename Makefile -> GNUmakefile to reflect dependency on GNU Make --- GNUmakefile | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 96 ---------------------------------------------------- certs/GNUmakefile | 66 ++++++++++++++++++++++++++++++++++++ certs/Makefile | 66 ------------------------------------ util-src/GNUmakefile | 34 +++++++++++++++++++ util-src/Makefile | 34 ------------------- 6 files changed, 196 insertions(+), 196 deletions(-) create mode 100644 GNUmakefile delete mode 100644 Makefile create mode 100644 certs/GNUmakefile delete mode 100644 certs/Makefile create mode 100644 util-src/GNUmakefile delete mode 100644 util-src/Makefile diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 00000000..d5751620 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,96 @@ + +include config.unix + +BIN = $(DESTDIR)$(PREFIX)/bin +CONFIG = $(DESTDIR)$(SYSCONFDIR) +MODULES = $(DESTDIR)$(LIBDIR)/prosody/modules +SOURCE = $(DESTDIR)$(LIBDIR)/prosody +DATA = $(DESTDIR)$(DATADIR) +MAN = $(DESTDIR)$(PREFIX)/share/man + +INSTALLEDSOURCE = $(LIBDIR)/prosody +INSTALLEDCONFIG = $(SYSCONFDIR) +INSTALLEDMODULES = $(LIBDIR)/prosody/modules +INSTALLEDDATA = $(DATADIR) + +INSTALL=install -p +INSTALL_DATA=$(INSTALL) -m644 +INSTALL_EXEC=$(INSTALL) -m755 +MKDIR=install -d +MKDIR_PRIVATE=$(MKDIR) -m750 + +.PHONY: all test clean install + +all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version + $(MAKE) -C util-src install +ifeq ($(EXCERTS),yes) + -$(MAKE) -C certs localhost.crt example.com.crt +endif + +install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so + $(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE) + $(MKDIR_PRIVATE) $(DATA) + $(MKDIR) $(MAN)/man1 + $(MKDIR) $(CONFIG)/certs + $(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util + $(INSTALL_EXEC) ./prosody.install $(BIN)/prosody + $(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl + $(INSTALL_DATA) core/*.lua $(SOURCE)/core + $(INSTALL_DATA) net/*.lua $(SOURCE)/net + $(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/resolvers $(SOURCE)/net/websocket + $(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http + $(INSTALL_DATA) net/resolvers/*.lua $(SOURCE)/net/resolvers + $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket + $(INSTALL_DATA) util/*.lua $(SOURCE)/util + $(INSTALL_DATA) util/*.so $(SOURCE)/util + $(MKDIR) $(SOURCE)/util/sasl + $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl + $(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc $(MODULES)/mod_mam + $(INSTALL_DATA) plugins/*.lua $(MODULES) + $(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)/mod_s2s + $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)/mod_pubsub + $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)/adhoc + $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)/muc + $(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam + $(INSTALL_DATA) certs/* $(CONFIG)/certs + $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1 + test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua + -test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version + $(MAKE) install -C util-src + +clean: + rm -f prosody.install + rm -f prosodyctl.install + rm -f prosody.cfg.lua.install + rm -f prosody.version + $(MAKE) clean -C util-src + +test: + busted --lua=$(RUNWITH) + +util/%.so: + $(MAKE) install -C util-src + +%.install: % + sed "1s| lua$$| $(RUNWITH)|; \ + s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \ + s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \ + s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \ + s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < $^ > $@ + +prosody.cfg.lua.install: prosody.cfg.lua.dist + sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' $^ > $@ + +%.version: %.release + cp $^ $@ + +%.version: .hg_archival.txt + sed -n 's/^node: \(............\).*/\1/p' $^ > $@ + +%.version: .hg/dirstate + hexdump -n6 -e'6/1 "%02x"' $^ > $@ + +%.version: + echo unknown > $@ + + diff --git a/Makefile b/Makefile deleted file mode 100644 index d5751620..00000000 --- a/Makefile +++ /dev/null @@ -1,96 +0,0 @@ - -include config.unix - -BIN = $(DESTDIR)$(PREFIX)/bin -CONFIG = $(DESTDIR)$(SYSCONFDIR) -MODULES = $(DESTDIR)$(LIBDIR)/prosody/modules -SOURCE = $(DESTDIR)$(LIBDIR)/prosody -DATA = $(DESTDIR)$(DATADIR) -MAN = $(DESTDIR)$(PREFIX)/share/man - -INSTALLEDSOURCE = $(LIBDIR)/prosody -INSTALLEDCONFIG = $(SYSCONFDIR) -INSTALLEDMODULES = $(LIBDIR)/prosody/modules -INSTALLEDDATA = $(DATADIR) - -INSTALL=install -p -INSTALL_DATA=$(INSTALL) -m644 -INSTALL_EXEC=$(INSTALL) -m755 -MKDIR=install -d -MKDIR_PRIVATE=$(MKDIR) -m750 - -.PHONY: all test clean install - -all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version - $(MAKE) -C util-src install -ifeq ($(EXCERTS),yes) - -$(MAKE) -C certs localhost.crt example.com.crt -endif - -install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so - $(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE) - $(MKDIR_PRIVATE) $(DATA) - $(MKDIR) $(MAN)/man1 - $(MKDIR) $(CONFIG)/certs - $(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util - $(INSTALL_EXEC) ./prosody.install $(BIN)/prosody - $(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl - $(INSTALL_DATA) core/*.lua $(SOURCE)/core - $(INSTALL_DATA) net/*.lua $(SOURCE)/net - $(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/resolvers $(SOURCE)/net/websocket - $(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http - $(INSTALL_DATA) net/resolvers/*.lua $(SOURCE)/net/resolvers - $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket - $(INSTALL_DATA) util/*.lua $(SOURCE)/util - $(INSTALL_DATA) util/*.so $(SOURCE)/util - $(MKDIR) $(SOURCE)/util/sasl - $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl - $(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc $(MODULES)/mod_mam - $(INSTALL_DATA) plugins/*.lua $(MODULES) - $(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)/mod_s2s - $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)/mod_pubsub - $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)/adhoc - $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)/muc - $(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam - $(INSTALL_DATA) certs/* $(CONFIG)/certs - $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1 - test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua - -test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version - $(MAKE) install -C util-src - -clean: - rm -f prosody.install - rm -f prosodyctl.install - rm -f prosody.cfg.lua.install - rm -f prosody.version - $(MAKE) clean -C util-src - -test: - busted --lua=$(RUNWITH) - -util/%.so: - $(MAKE) install -C util-src - -%.install: % - sed "1s| lua$$| $(RUNWITH)|; \ - s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \ - s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \ - s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \ - s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < $^ > $@ - -prosody.cfg.lua.install: prosody.cfg.lua.dist - sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' $^ > $@ - -%.version: %.release - cp $^ $@ - -%.version: .hg_archival.txt - sed -n 's/^node: \(............\).*/\1/p' $^ > $@ - -%.version: .hg/dirstate - hexdump -n6 -e'6/1 "%02x"' $^ > $@ - -%.version: - echo unknown > $@ - - diff --git a/certs/GNUmakefile b/certs/GNUmakefile new file mode 100644 index 00000000..fd4a2932 --- /dev/null +++ b/certs/GNUmakefile @@ -0,0 +1,66 @@ +.DEFAULT: localhost.crt +keysize=2048 + +# How to: +# First, `make yourhost.cnf` which creates a openssl config file. +# Then edit this file and fill in the details you want it to have, +# and add or change hosts and components it should cover. +# Then `make yourhost.key` to create your private key, you can +# include keysize=number to change the size of the key. +# Then you can either `make yourhost.csr` to generate a certificate +# signing request that you can submit to a CA, or `make yourhost.crt` +# to generate a self signed certificate. + +.PRECIOUS: %.cnf %.key + +# To request a cert +%.csr: %.cnf %.key + openssl req -new -key $(lastword $^) \ + -sha256 -utf8 -config $(firstword $^) -out $@ + +%.csr: %.cnf + umask 0077 && touch $*.key + openssl req -new -newkey rsa:$(keysize) -nodes -keyout $*.key \ + -sha256 -utf8 -config $^ -out $@ + @chmod 400 $*.key + +%.csr: %.key + openssl req -new -key $^ -utf8 -subj /CN=$* -out $@ + +%.csr: + umask 0077 && touch $*.key + openssl req -new -newkey rsa:$(keysize) -nodes -keyout $*.key \ + -utf8 -subj /CN=$* -out $@ + @chmod 400 $*.key + +# Self signed +%.crt: %.cnf %.key + openssl req -new -x509 -key $(lastword $^) -days 365 -sha256 -utf8 \ + -config $(firstword $^) -out $@ + +%.crt: %.cnf + umask 0077 && touch $*.key + openssl req -new -x509 -newkey rsa:$(keysize) -nodes -keyout $*.key \ + -days 365 -sha256 -utf8 -config $(firstword $^) -out $@ + @chmod 400 $*.key + +%.crt: %.key + openssl req -new -x509 -key $^ -days 365 -sha256 -utf8 -subj /CN=$* -out $@ + +%.crt: + umask 0077 && touch $*.key + openssl req -new -x509 -newkey rsa:$(keysize) -nodes -keyout $*.key \ + -days 365 -sha256 -out $@ -utf8 -subj /CN=$* + @chmod 400 $*.key + +# Generate a config from the example +%.cnf: + sed 's,example\.com,$*,g' openssl.cnf > $@ + +%.key: + umask 0077 && openssl genrsa -out $@ $(keysize) + @chmod 400 $@ + +# Generate Diffie-Hellman parameters +dh-%.pem: + openssl dhparam -out $@ $* diff --git a/certs/Makefile b/certs/Makefile deleted file mode 100644 index fd4a2932..00000000 --- a/certs/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -.DEFAULT: localhost.crt -keysize=2048 - -# How to: -# First, `make yourhost.cnf` which creates a openssl config file. -# Then edit this file and fill in the details you want it to have, -# and add or change hosts and components it should cover. -# Then `make yourhost.key` to create your private key, you can -# include keysize=number to change the size of the key. -# Then you can either `make yourhost.csr` to generate a certificate -# signing request that you can submit to a CA, or `make yourhost.crt` -# to generate a self signed certificate. - -.PRECIOUS: %.cnf %.key - -# To request a cert -%.csr: %.cnf %.key - openssl req -new -key $(lastword $^) \ - -sha256 -utf8 -config $(firstword $^) -out $@ - -%.csr: %.cnf - umask 0077 && touch $*.key - openssl req -new -newkey rsa:$(keysize) -nodes -keyout $*.key \ - -sha256 -utf8 -config $^ -out $@ - @chmod 400 $*.key - -%.csr: %.key - openssl req -new -key $^ -utf8 -subj /CN=$* -out $@ - -%.csr: - umask 0077 && touch $*.key - openssl req -new -newkey rsa:$(keysize) -nodes -keyout $*.key \ - -utf8 -subj /CN=$* -out $@ - @chmod 400 $*.key - -# Self signed -%.crt: %.cnf %.key - openssl req -new -x509 -key $(lastword $^) -days 365 -sha256 -utf8 \ - -config $(firstword $^) -out $@ - -%.crt: %.cnf - umask 0077 && touch $*.key - openssl req -new -x509 -newkey rsa:$(keysize) -nodes -keyout $*.key \ - -days 365 -sha256 -utf8 -config $(firstword $^) -out $@ - @chmod 400 $*.key - -%.crt: %.key - openssl req -new -x509 -key $^ -days 365 -sha256 -utf8 -subj /CN=$* -out $@ - -%.crt: - umask 0077 && touch $*.key - openssl req -new -x509 -newkey rsa:$(keysize) -nodes -keyout $*.key \ - -days 365 -sha256 -out $@ -utf8 -subj /CN=$* - @chmod 400 $*.key - -# Generate a config from the example -%.cnf: - sed 's,example\.com,$*,g' openssl.cnf > $@ - -%.key: - umask 0077 && openssl genrsa -out $@ $(keysize) - @chmod 400 $@ - -# Generate Diffie-Hellman parameters -dh-%.pem: - openssl dhparam -out $@ $* diff --git a/util-src/GNUmakefile b/util-src/GNUmakefile new file mode 100644 index 00000000..4b8540c5 --- /dev/null +++ b/util-src/GNUmakefile @@ -0,0 +1,34 @@ + +include ../config.unix + +CFLAGS+=-I$(LUA_INCDIR) + +INSTALL_DATA=install -m644 +TARGET?=../util/ + +ALL=encodings.so hashes.so net.so pposix.so signal.so table.so ringbuffer.so + +ifdef RANDOM +ALL+=crand.so +endif + +.PHONY: all install clean +.SUFFIXES: .c .o .so + +all: $(ALL) + +install: $(ALL) + $(INSTALL_DATA) $? $(TARGET) + +clean: + rm -f $(ALL) $(patsubst %.so,%.o,$(ALL)) + +encodings.so: LDLIBS+=$(IDNA_LIBS) + +hashes.so: LDLIBS+=$(OPENSSL_LIBS) + +crand.o: CFLAGS+=-DWITH_$(RANDOM) +crand.so: LDLIBS+=$(RANDOM_LIBS) + +%.so: %.o + $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) diff --git a/util-src/Makefile b/util-src/Makefile deleted file mode 100644 index f18d5a80..00000000 --- a/util-src/Makefile +++ /dev/null @@ -1,34 +0,0 @@ - -include ../config.unix - -CFLAGS+=-I$(LUA_INCDIR) - -INSTALL_DATA=install -m644 -TARGET?=../util/ - -ALL=encodings.so hashes.so net.so pposix.so signal.so table.so ringbuffer.so - -ifdef RANDOM -ALL+=crand.so -endif - -.PHONY: all install clean -.SUFFIXES: .c .o .so - -all: $(ALL) - -install: $(ALL) - $(INSTALL_DATA) $^ $(TARGET) - -clean: - rm -f $(ALL) $(patsubst %.so,%.o,$(ALL)) - -encodings.so: LDLIBS+=$(IDNA_LIBS) - -hashes.so: LDLIBS+=$(OPENSSL_LIBS) - -crand.o: CFLAGS+=-DWITH_$(RANDOM) -crand.so: LDLIBS+=$(RANDOM_LIBS) - -%.so: %.o - $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) -- cgit v1.2.3