diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 56 |
1 files changed, 25 insertions, 31 deletions
@@ -22,7 +22,7 @@ DESTDIR = .SUFFIXES: -.SUFFIXES: .in .c .bin +.SUFFIXES: .in .go .bin .bin-check .in: sed \ @@ -34,14 +34,17 @@ DESTDIR = < $< > $@ if [ -x $< ]; then chmod +x $@; fi -.c.bin: - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) +.go.bin: + CGO_ENABLED=0 go test -c -o $@ -v \ + -ldflags='-s -w -extldflags "-static"' $< all: include deps.mk +tests.bin = $(tests.go:.go=.bin) + manpages = $(manpages.in:.in=) sources = \ @@ -56,16 +59,14 @@ installable = \ derived-assets = \ $(manpages) \ - tests/rand.bin \ - tests/bigger-rand-output.txt \ + main.bin \ + $(tests.bin) \ side-assets = \ - tests/hero-*.pipe \ - tests/hero-*.socket \ - web.pipe \ + ircd.pipe \ lighttpd.socket \ ircd.socket \ - web.socket \ + wscat.socket \ @@ -73,22 +74,20 @@ side-assets = \ ## and installation. all: $(derived-assets) -tests/bigger-rand-output.txt: tests/rand.bin - printf '[\n\t%s\n]\n' \ - "`./$? | tr '\n' ',' | sed -e 's|,$$||' -e 's|,|,\n\t|g'`" > $@ - -tests/rand.bin $(manpages): Makefile deps.mk -tests/js/rand.mjs-check: tests/bigger-rand-output.txt +main.bin: ALWAYS + CGO_ENABLED=0 go build -o $@ -v \ + -ldflags='-s -w -extldflags "-static"' src/cmd/papo.go + +$(tests.bin): ALWAYS -.SUFFIXES: .mjs .mjs-check -tests.mjs-check = $(tests.mjs:.mjs=.mjs-check) -$(tests.mjs-check): - node $*.mjs +tests.bin-check = $(tests.go:.go=.bin-check) +$(tests.bin-check): + ./$*.bin -check-unit: $(tests.mjs-check) +check-unit: $(tests.bin-check) integration-tests = \ @@ -129,7 +128,7 @@ install: all mkdir -p "$$dir"; \ cp -P "$$f" "$$dir"; \ done - sh tools/manpages.sh -ip '$(DESTDIR)$(MANDIR)' $(manpages) + doctool -ip '$(DESTDIR)$(MANDIR)' $(manpages) ## Uninstalls from $(DESTDIR)$(PREFIX). This is a perfect mirror ## of the "install" target, and removes *all* that was installed. @@ -139,14 +138,14 @@ uninstall: '$(DESTDIR)$(BINDIR)'/$(NAME) \ '$(DESTDIR)$(JSLIBDIR)' \ '$(DESTDIR)$(SRCDIR)' - sh tools/manpages.sh -up '$(DESTDIR)$(MANDIR)' $(manpages) + doctool -up '$(DESTDIR)$(MANDIR)' $(manpages) run-ircd: all ./src/bin.mjs ircd ircd.socket -run-web: all - ./src/bin.mjs web web.socket web.pipe +run-wscat: all + websockify --unix-listen=wscat.socket --unix-target=ircd.socket run-proxy: all lighttpd -Df tests/lighttpd.conf @@ -154,17 +153,12 @@ run-proxy: all run-binder: all socat tcp-listen:6001,fork,reuseaddr unix:lighttpd.socket -## Run the web and IRC server locally. +## Run the IRC server locally and its helper programs. run: all - for c in ircd web proxy binder; do \ + for c in ircd wscat proxy binder; do \ $(MAKE) run-$$c & \ done; \ wait -## Show this help. -help: - sh tools/makehelp.sh < Makefile - - ALWAYS: |
