summaryrefslogtreecommitdiff
path: root/Maakbestand
diff options
context:
space:
mode:
Diffstat (limited to 'Maakbestand')
-rw-r--r--Maakbestand12
1 files 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)"