diff options
author | Marvin Borner | 2023-02-20 22:43:40 +0100 |
---|---|---|
committer | Marvin Borner | 2023-02-20 22:43:40 +0100 |
commit | 03c1fb0de6b4aa4b6eaa3ef549b415a78daaf821 (patch) | |
tree | 2daa6163e2391feb5908f3633f527004d9090e81 | |
parent | d0b4cf4497d9dfdb0a5f5f973af25008f8b5c65f (diff) |
Added install
-rw-r--r-- | makefile | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -4,10 +4,10 @@ CC = gcc TG = ctags -BUILD = $(PWD)/build -SRC = $(PWD)/src -INC = $(PWD)/inc -LIB = $(PWD)/lib +BUILD = ${CURDIR}/build +SRC = ${CURDIR}/src +INC = ${CURDIR}/inc +LIB = ${CURDIR}/lib SRCS = $(wildcard $(SRC)/*.c) OBJS = $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(SRCS)) @@ -26,6 +26,10 @@ ifdef DEBUG # TODO: Somehow clean automagically CFLAGS += $(CFLAGS_DEBUG) endif +ifeq ($(PREFIX),) + PREFIX := /usr/local +endif + all: compile sync compile: $(BUILD) $(OBJS) $(BUILD)/calm @@ -33,6 +37,9 @@ compile: $(BUILD) $(OBJS) $(BUILD)/calm clean: @rm -rf $(BUILD)/* +install: + @install -m 755 $(BUILD)/calm $(DESTDIR)$(PREFIX)/bin/ + sync: # Ugly hack @$(MAKE) $(BUILD)/calm --always-make --dry-run | grep -wE 'gcc|g\+\+' | grep -w '\-c' | jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$$").string[1:]}]' >compile_commands.json @$(TG) -R --exclude=.git --exclude=build . |