summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-10-06 07:38:46 -0300
committerEuAndreh <eu@euandre.org>2023-11-09 06:58:46 -0300
commitaf33deff64661769acc7762d22e7e8bea051c318 (patch)
treea939d2273490aee5f75ccb5692d3b9592b17f318 /Makefile
parentdoc/rfc/: Add verbatim text for RFC 1459 and 281{0,1,2,3} (diff)
downloadpapod-af33deff64661769acc7762d22e7e8bea051c318.tar.gz
papod-af33deff64661769acc7762d22e7e8bea051c318.tar.xz
Initial project structure
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile134
1 files changed, 134 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f590e16
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,134 @@
+.POSIX:
+DATE = 1970-01-01
+VERSION = 0.1.0
+NAME = papo
+NAME_UC = $(NAME)
+URL = papo.im
+LIST = list@$(URL)
+TRANSLATIONS =
+## Installation prefix. Defaults to "/usr".
+PREFIX = /usr
+BINDIR = $(PREFIX)/bin
+LIBDIR = $(PREFIX)/lib
+JSLIBDIR = $(LIBDIR)/$(NAME)
+SHAREDIR = $(PREFIX)/share
+LOCALEDIR = $(SHAREDIR)/locale
+MANDIR = $(SHAREDIR)/man
+## Where to store the installation. Empty by default.
+DESTDIR =
+JSIMPL = node
+
+
+
+.SUFFIXES:
+.SUFFIXES: .in
+
+.in:
+ sed \
+ -e 's:@VERSION@:$(VERSION):g' \
+ -e 's:@DATE@:$(DATE):g' \
+ -e 's:@NAME@:$(NAME):g' \
+ -e 's:@LIST@:$(LIST):g' \
+ -e 's:@URL@:$(URL):g' \
+ < $< > $@
+ if [ -x $< ]; then chmod +x $@; fi
+
+
+
+manpages.en.in = \
+ doc/$(NAME).README.en.7.in \
+ doc/$(NAME).CHANGELOG.en.7.in \
+ doc/$(NAME).TODOs.en.7.in \
+ doc/$(NAME).en.1.in \
+ doc/$(NAME).tutorial.en.7.in \
+ doc/$(NAME).recipes.en.7.in \
+ doc/$(NAME).why.en.7.in
+manpages.in = $(manpages.en.in)
+manpages = $(manpages.in:.in=)
+
+sources.js = \
+ src/compat.js \
+ src/utils.js \
+ src/server/web.js \
+ src/client.js \
+
+tests.js = \
+ tests/js/compat.js \
+ tests/js/utils.js \
+ tests/js/server/web.js \
+
+
+sources = \
+ $(sources.js) \
+
+
+derived-assets = \
+ $(manpages) \
+
+
+
+## Default target. Builds all artifacts required for testing
+## and installation.
+all: $(derived-assets)
+
+
+$(manpages): Makefile
+
+
+
+.SUFFIXES: .js .js-t
+tests.js-t = $(tests.js:.js=.js-t)
+$(tests.js-t):
+ $(JSIMPL) tests/runner.js $*.js
+
+check-t: $(tests.js-t)
+
+
+
+## Run all tests. Each test suite is isolated, so that a parallel
+## build can run tests at the same time. The required artifacts
+## are created if required.
+check: check-t
+
+
+## Remove *all* derived artifacts produced during the build.
+## A dedicated test asserts that this is always true.
+clean:
+ rm -rf $(derived-assets)
+
+
+## Installs into $(DESTDIR)$(PREFIX). Its dependency target
+## ensures that all installable artifacts are crafted beforehand.
+install: all
+ mkdir -p \
+ '$(DESTDIR)$(BINDIR)'
+ cp src/bin/$(NAME) '$(DESTDIR)$(BINDIR)'
+ sh tools/manpages.sh -ip '$(DESTDIR)$(MANDIR)' $(manpages)
+
+## Uninstalls from $(DESTDIR)$(PREFIX). This is a perfect mirror
+## of the "install" target, and removes *all* that was installed.
+## A dedicated test asserts that this is always true.
+uninstall:
+ rm -f \
+ '$(DESTDIR)$(BINDIR)'/$(NAME)
+ sh tools/manpages.sh -up '$(DESTDIR)$(MANDIR)' $(manpages)
+
+
+run-ircd:
+ $(JSIMPL) src/server/web.js server -l http://localhost:3000
+
+run-web:
+ $(JSIMPL) src/server/web.js server -l http://localhost:3003
+
+## Run the web and IRC server locally
+run:
+ $(MAKE) run-ircd & $(MAKE) run-web & wait
+
+
+MAKEFILE = Makefile
+## Show this help.
+help:
+ cat $(MAKEFILE) | sh tools/makehelp.sh
+
+
+ALWAYS: