diff options
author | Tom Smeding <t.j.smeding@uu.nl> | 2024-07-13 23:03:39 +0200 |
---|---|---|
committer | Tom Smeding <t.j.smeding@uu.nl> | 2024-07-13 23:03:39 +0200 |
commit | 3e3d08a7d36b45b13bbec559780f8d421aadf8a7 (patch) | |
tree | 4cfdfaa7fdad8e60736d6153a17400af1b0969db /Maakbestand | |
parent | ea211a7b2d2deec4f5b8451782e930caeb51c295 (diff) |
Install target
Diffstat (limited to 'Maakbestand')
-rw-r--r-- | Maakbestand | 12 |
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)" |