commit 15ade3d4f156b70da74f599cd2f16dd818e63c41 parent 42636a96271693fc5545da691d624b51b6192b5f Author: Louis Burda <quent.burda@gmail.com> Date: Mon, 13 Mar 2023 21:41:56 +0100 Reorganize and fix install target Diffstat:
M | .gitignore | | | 5 | +---- |
M | Makefile | | | 33 | ++++++++++++++++++--------------- |
R | bootstr.h -> include/bootstr.h | | | 0 | |
R | bootstr.c -> src/bootstr.c | | | 0 | |
R | puny.c -> src/puny.c | | | 0 | |
R | test/basic.in -> test/puny-basic.in | | | 0 | |
R | test/basic.out -> test/puny-basic.out | | | 0 |
7 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -1,4 +1 @@ -puny -bootstr -*.o -*.so +build diff --git a/Makefile b/Makefile @@ -1,31 +1,34 @@ PREFIX ?= /usr/local -BINDIR ?= /bin LIBDIR ?= /lib +INCLDIR ?= /include -all: libbootstr.so puny +all: build/libbootstr.so build/puny clean: - rm -f puny + rm -rf build -puny: puny.c libbootstr.so - $(CC) -o $@ $(filter %.c,$^) -g -lunistring -L . -lbootstr +build: + mkdir build -test/%.phony: test/%.in test/%.out - @echo "test $*" - test "$(shell cat test/$*.in | ./puny -e)" = "$(shell cat test/$*.out)" - test "$(shell cat test/$*.out | ./puny -d)" = "$(shell cat test/$*.in)" +build/puny: src/puny.c build/libbootstr.so | build + $(CC) -o $@ $< -g -I include -L build -lunistring -lbootstr + +build/libbootstr.so: src/bootstr.c include/bootstr.h | build + $(CC) -o $@ $< -I include -fPIC -shared -lunistring -test: puny test/basic.phony +test/%.phony: test/%.in test/%.out + @echo "> test $*" + test "$(shell cat test/$*.in | ./build/puny -e)" = "$(shell cat test/$*.out)" + test "$(shell cat test/$*.out | ./build/puny -d)" = "$(shell cat test/$*.in)" -libbootstr.so: bootstr.o - $(CC) -o $@ $^ -fPIC -shared -lunistring +test: build/puny test/puny-basic.phony install: - install -m755 libbootstr.so -t "$(DESTDIR)$(PREFIX)$(LIBDIR)" - install -m755 puny -t "$(DESTDIR)$(PREFIX)$(BINDIR)" + install -m644 include/bootstr.h -t "$(DESTDIR)$(PREFIX)$(INCLDIR)" + install -m755 build/libbootstr.so -t "$(DESTDIR)$(PREFIX)$(LIBDIR)" uninstall: + rm -f "$(DESTDIR)$(PREFIX)$(INCLDIR)/bootstr.h" rm -f "$(DESTDIR)$(PREFIX)$(LIBDIR)/libbootstr.so" - rm -f "$(DESTDIR)$(PREFIX)$(BINDIR)/puny" .PHONY: all clean test install uninstall diff --git a/bootstr.h b/include/bootstr.h diff --git a/bootstr.c b/src/bootstr.c diff --git a/puny.c b/src/puny.c diff --git a/test/basic.in b/test/puny-basic.in diff --git a/test/basic.out b/test/puny-basic.out