summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 17 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 78b1ca7..65787e4 100644
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,7 @@ LANGUAGES =
## Installation prefix. Defaults to "/usr".
PREFIX = /usr
BINDIR = $(PREFIX)/bin
-LIBDIR = $(PREFIX)/lib
-JSLIBDIR = $(LIBDIR)/node/$(NAME)
+LIBDDIR = $(PREFIX)/lib/$(NAME)
SRCDIR = $(PREFIX)/src/$(NAME)
SHAREDIR = $(PREFIX)/share
LOCALEDIR = $(SHAREDIR)/locale
@@ -22,7 +21,7 @@ DESTDIR =
.SUFFIXES:
-.SUFFIXES: .in .go .bin .bin-check
+.SUFFIXES: .in
.in:
sed \
@@ -34,33 +33,24 @@ DESTDIR =
< $< > $@
if [ -x $< ]; then chmod +x $@; fi
-.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 = \
- $(sources.mjs) \
-
-installable = \
+ $(sources.static) \
$(sources.sql) \
- $(sources.mjs) \
- src/sqlite.cjs \
- src/package.json \
+ src/papo.go \
+ src/cmd/papo.go \
derived-assets = \
$(manpages) \
main.bin \
- $(tests.bin) \
+ tests/papo_test.bin \
side-assets = \
ircd.pipe \
@@ -75,26 +65,25 @@ side-assets = \
all: $(derived-assets)
-main.bin: ALWAYS
+main.bin: src/papo.go src/cmd/papo.go
CGO_ENABLED=0 go build -o $@ -v \
-ldflags='-s -w -extldflags "-static"' src/cmd/papo.go
-
-$(tests.bin): ALWAYS
+tests/papo_test.bin: src/papo.go tests/papo_test.go
+ CGO_ENABLED=0 go test -c -o $@ -v \
+ -ldflags='-s -w -extldflags "-static"' tests/papo_test.go
-tests.bin-check = $(tests.go:.go=.bin-check)
-$(tests.bin-check):
- ./$*.bin
-check-unit: $(tests.bin-check)
+check-unit: tests/papo_test.bin
+ ./tests/papo_test.bin
integration-tests = \
tests/cli-opts.sh \
$(integration-tests): ALWAYS
- sh $@ $(EXEC)src/bin.mjs
+ sh $@
check-integration: $(integration-tests)
@@ -115,11 +104,10 @@ clean:
## ensures that all installable artifacts are crafted beforehand.
install: all
mkdir -p \
- '$(DESTDIR)$(BINDIR)' \
- '$(DESTDIR)$(JSLIBDIR)'
- ln -fs '$(DESTDIR)$(JSLIBDIR)'/bin.mjs '$(DESTDIR)$(BINDIR)'/$(NAME)
- for f in $(installable); do \
- dir='$(DESTDIR)$(JSLIBDIR)'/"`dirname "$${f#src/}"`"; \
+ '$(DESTDIR)$(BINDIR)'
+ cp main.bin '$(DESTDIR)$(BINDIR)'/$(NAME)
+ for f in $(sources.sql) $(sources.static); do \
+ dir='$(DESTDIR)$(LIBDDIR)'/"`dirname "$${f#src/}"`"; \
mkdir -p "$$dir"; \
cp -P "$$f" "$$dir"; \
done
@@ -136,7 +124,6 @@ install: all
uninstall:
rm -rf \
'$(DESTDIR)$(BINDIR)'/$(NAME) \
- '$(DESTDIR)$(JSLIBDIR)' \
'$(DESTDIR)$(SRCDIR)'
doctool -up '$(DESTDIR)$(MANDIR)' $(manpages)