no-more-secrets-rust/Makefile
2023-11-12 11:43:23 -08:00

60 lines
1.5 KiB
Makefile

# Installation directories following GNU conventions
prefix ?= /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
sbindir = $(exec_prefix)/sbin
datarootdir = $(prefix)/share
datadir = $(datarootdir)
includedir = $(prefix)/include
mandir = $(datarootdir)/man
BIN=bin
OBJ=obj
SRC=src
CC ?= gcc
CFLAGS ?= -Wextra -Wall -O2
.PHONY: all install uninstall clean
nms: $(OBJ)/error.o $(OBJ)/nmstermio.o $(OBJ)/nmseffect.o $(OBJ)/nms.o | $(BIN)
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ target/release/libnmsrust.a
sneakers: $(OBJ)/nmstermio.o $(OBJ)/nmseffect.o $(OBJ)/sneakers.o | $(BIN)
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ target/release/libnmsrust.a
all: nms sneakers
all-ncurses: nms-ncurses sneakers-ncurses
nms-ncurses: $(OBJ)/error.o $(OBJ)/nmstermio_ncurses.o $(OBJ)/nmseffect.o $(OBJ)/nms.o | $(BIN)
$(CC) $(CFLAGS) -o $(BIN)/nms $^ -lncursesw target/release/libnmsrust.a
sneakers-ncurses: $(OBJ)/nmstermio_ncurses.o $(OBJ)/nmseffect.o $(OBJ)/sneakers.o | $(BIN)
$(CC) $(CFLAGS) -o $(BIN)/sneakers $^ -lncursesw target/release/libnmsrust.a
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ)
$(CC) $(CFLAGS) -o $@ -c $<
$(BIN):
mkdir $(BIN)
$(OBJ):
mkdir $(OBJ)
clean:
rm -rf $(BIN)
rm -rf $(OBJ)
install:
install -d $(DESTDIR)$(mandir)/man6
install -m644 nms.6 sneakers.6 $(DESTDIR)$(mandir)/man6
install -d $(DESTDIR)$(bindir)
cd $(BIN) && install * $(DESTDIR)$(bindir)
uninstall:
rm -f $(DESTDIR)$(bindir)/nms;
rm -f $(DESTDIR)$(bindir)/sneakers;
rm -f $(DESTDIR)$(mandir)/man6/nms.6
rm -f $(DESTDIR)$(mandir)/man6/sneakers.6