summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-03-13 21:41:56 +0100
committerLouis Burda <quent.burda@gmail.com>2023-03-13 21:42:03 +0100
commit15ade3d4f156b70da74f599cd2f16dd818e63c41 (patch)
treebe1bb8ff2909cd9cfc694c9f11ef2471144e605f /Makefile
parent42636a96271693fc5545da691d624b51b6192b5f (diff)
downloadlibbootstr-c-15ade3d4f156b70da74f599cd2f16dd818e63c41.tar.gz
libbootstr-c-15ade3d4f156b70da74f599cd2f16dd818e63c41.zip
Reorganize and fix install target
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 18 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index a75f410..8aabe31 100644
--- 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