From 3e3d08a7d36b45b13bbec559780f8d421aadf8a7 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 13 Jul 2024 23:03:39 +0200 Subject: Install target --- Maakbestand | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Maakbestand b/Maakbestand index 177df33..7b20ca7 100644 --- a/Maakbestand +++ b/Maakbestand @@ -1,5 +1,7 @@ VERSION := $(shell ./versie.sh) +PREFIX ?= /usr + CC := gcc CFLAGS := -Wall -Wextra -std=c2x -O2 -D_GNU_SOURCE -DDRUKKEDOOS_VERSIE=\"$(VERSION)\" LDFLAGS := @@ -11,15 +13,21 @@ SOURCES := $(shell find src -type f -name '*.c') HEADERS := $(shell find src -type f -name '*.h') OBJECTS := $(patsubst src/%.c,obj/%.o,$(SOURCES)) -PROGNAMES_X := $(patsubst src/%.c,X(%),$(wildcard src/*.c)) +PROGNAMES := $(patsubst src/%.c,%,$(wildcard src/*.c)) +PROGNAMES_X := $(patsubst %,X(%),$(PROGNAMES)) -.PHONY: all clean +.PHONY: all clean install all: $(TARGET) clean: rm -rf $(OBJDIR) $(TARGET) +install: $(TARGET) + mkdir -p $(PREFIX)/bin + install $(TARGET) $(PREFIX)/bin/drukkedoos + for name in $(PROGNAMES); do ln -vfs drukkedoos $(PREFIX)/bin/$$name; done + $(TARGET): main.c $(OBJECTS) $(CC) -o $@ $^ $(LDFLAGS) -DPROGNAMES_XLIST="$(PROGNAMES_X)" -- cgit v1.2.3-70-g09d2