libhexa/makefile

78 lines
2.4 KiB
Makefile
Raw Normal View History

2024-06-21 01:07:12 +02:00
all: build
help:
@echo "usage: make [build|install|doc|serve-doc]"
ZIGOPTS ?=
ZIGOPTIM ?= ReleaseSafe
-include makefile.target
# Build both the application and the library (static & dynamic).
2024-06-21 01:07:12 +02:00
build:
zig build -Doptimize=$(ZIGOPTIM) $(ZIGOPTS) $(TARGET_OPTION)
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
INCLUDEDIR ?= $(PREFIX)/include
PKGCONFIGDIR ?= /usr/share/pkgconfig
$(PKGCONFIGDIR):; install -m 0755 -d $(PKGCONFIGDIR)
$(PKGCONFIGDIR)/hexa.pc: hexa.pc; install -m 0644 hexa.pc $(PKGCONFIGDIR)
install-pkgconfig: $(PKGCONFIGDIR) $(PKGCONFIGDIR)/hexa.pc
$(LIBDIR):; install -m 0755 -d $(LIBDIR)
$(LIBDIR)/libhexa.a: zig-out/lib/libhexa.a; install -m 0644 zig-out/lib/libhexa.a $(LIBDIR)
$(LIBDIR)/libhexa.so: zig-out/lib/libhexa.so; install -m 0644 zig-out/lib/libhexa.so $(LIBDIR)
install-library: $(LIBDIR) $(LIBDIR)/libhexa.a $(LIBDIR)/libhexa.so
$(INCLUDEDIR):; install -m 0755 -d $(INCLUDEDIR)
$(INCLUDEDIR)/libhexa.h: libhexa.h; install -m 0644 libhexa.h $(INCLUDEDIR)
install-header: $(INCLUDEDIR) $(INCLUDEDIR)/libhexa.h
$(BINDIR):; install -m 0755 -d $(BINDIR)
$(BINDIR)/hexa: zig-out/bin/hexa; install -m 0755 zig-out/bin/hexa $(BINDIR)
install-bin: $(BINDIR) $(BINDIR)/hexa
install: install-bin install-pkgconfig install-library install-header
@echo "Now that you have installed the library, you should (probably) run ldconfig."
2024-06-21 21:53:18 +02:00
uninstall-library:; rm $(LIBDIR)/libhexa.a $(LIBDIR)/libhexa.so*
uninstall-header:; rm $(INCLUDEDIR)/libhexa.h
uninstall-bin:; rm $(BINDIR)/hexa
uninstall-pkgconfig:; rm $(PKGCONFIGDIR)/hexa.pc
uninstall: uninstall-pkgconfig uninstall-library uninstall-header uninstall-bin
mrproper:
rm -r docs zig-cache zig-out 2>/dev/null || true
doc:
zig build-lib -femit-docs src/application.zig src/bindings.zig src/libhexa.zig
DOC_HTTPD_ACCESS_LOGS ?= /tmp/access-libhexa.log
DOC_HTTPD_ADDR ?= 127.0.0.1
DOC_HTTPD_PORT ?= 35002
serve-doc:
darkhttpd docs/ --addr $(DOC_HTTPD_ADDR) --port $(DOC_HTTPD_PORT) --log $(DOC_HTTPD_ACCESS_LOGS)
PACKAGE ?= libhexa
VERSION ?= 0.1.0
PKG = $(PACKAGE)-$(VERSION)
2024-06-21 21:31:03 +02:00
$(PKG).tar.gz: dist-dir
tar zcf $@ \
$(PKG)/src \
2024-06-21 21:31:03 +02:00
$(PKG)/build.zig* \
$(PKG)/libhexa.h \
2024-06-21 21:31:03 +02:00
$(PKG)/hexa.pc \
$(PKG)/makefile*
$(PKG):; ln -s . $(PKG)
dist-dir: $(PKG)
dist-rm-dir:; rm $(PKG)
dist-gz: $(PKG).tar.gz
dist: dist-gz dist-rm-dir
# You can add your specific instructions there.
-include makefile.user