42/Makefile
2023-03-18 23:37:48 -04:00

44 lines
1.1 KiB
Makefile

# Adjust the following per your installation preferences.
# NOTE: if you change $(PKG_DATADIR) then you must change the DATADIR contant in
# src/main.rs to match, as this directory is hardcoded at compile time.
PREFIX = /usr
BINDIR = $(DESTDIR)$(PREFIX)/bin
DATADIR = $(DESTDIR)$(PREFIX)/share
PKG_DATADIR = $(DATADIR)/42
MAN1DIR = $(DATADIR)/man/man1
MAN4DIR = $(DATADIR)/man/man4
# Don't change anything below here unless you know what you're doing
VPATH += src
VPATH += man
VPATH += target/release
INSTALLDIRS = $(BINDIR) $(PKG_DATADIR) $(MAN1DIR) $(MAN4DIR)
all: 42
42: main.rs Cargo.toml
cargo build --release
install: install-bin install-data install-man
install-bin: 42 | $(BINDIR)
install $< $(BINDIR)/
install-data: | $(PKG_DATADIR)
install -m644 data/* $(PKG_DATADIR)/
install-man: 42.1 man.4 | $(MAN1DIR) $(MAN4DIR)
install -m644 man/42.1 $(MAN1DIR)/
install -m644 man/man.4 $(MAN4DIR)/
$(INSTALLDIRS):
install -d $@
clean:
cargo clean
uninstall:
rm -rf $(BINDIR)/42 $(PKG_DATADIR)/* $(MAN1DIR)/42.1 $(MAN4DIR)/man.4
.PHONY: all clean install install-bin install-data install-man uninstall