nctref/Makefile

28 lines
664 B
Makefile
Raw Permalink Normal View History

2023-08-27 19:48:06 +03:00
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
SOURCES := $(call rwildcard,src/,*.c)
HEADERS := $(call rwildcard,src/,*.h)
2024-11-25 17:33:46 +02:00
OBJECTS := $(patsubst src/%.c,build/%.o,$(SOURCES))
DEPS := $(patsubst build/%.o,build/%.d,$(OBJECTS))
2023-08-27 19:48:06 +03:00
PREFIX = /usr/local
2024-11-25 17:33:46 +02:00
CFLAGS = $(if $(DEBUGA),-DDEBUG=1,) -Wall $(if $(ASAN),-fsanitize=address,) -fno-PIE -no-pie -std=gnu11 $(if $(DEBUG),-O0 -g,-Os -s) -fms-extensions -Isrc -Wno-array-bounds -MMD -MP -flto
2023-08-27 19:48:06 +03:00
.PHONY: install clean
2024-11-25 17:33:46 +02:00
build/%.o: src/%.c
cc -c $(CFLAGS) -o $@ $<
ntc: $(OBJECTS)
cc $(CFLAGS) -o ntc $(OBJECTS)
2023-08-27 19:48:06 +03:00
install: ntc
mv ./ntc $(PREFIX)/bin
clean:
rm ./ntc
2024-11-25 17:33:46 +02:00
-include $(DEPS)