pure-vec/Makefile

38 lines
563 B
Makefile
Raw Permalink Normal View History

2025-02-17 01:03:46 +01:00
CC = gcc
CCFLAGS = -Wall
BUILDDIR = build
SRCS = main.c
OBJS = $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o,$(SRCS)))
OUT = cvec
INSTALL_PATH?=/usr/local
INSTALL_PATH_BIN=$(INSTALL_PATH)/bin
.PHONY: all debug format clean
.PRECIOUS: $(BUILDDIR)/. $(BUILDDIR)%/.
all: $(OUT)
debug: CCFLAGS += -g
debug: all
$(BUILDDIR)/.:
mkdir -p $@
$(BUILDDIR)%/.:
mkdir -p $@
$(OUT): $(OBJS)
$(CC) $^ -o $(OUT)
.SECONDEXPANSION:
$(BUILDDIR)/%.o: %.c | $$(@D)/.
$(CC) $(CCFLAGS) -c $< -o $@
format:
clang-format -i *.c *.h
clean:
rm -rf $(BUILDDIR)
rm -f $(OUT)