CPlay/Makefile
2025-09-07 21:57:58 +02:00

42 lines
745 B
Makefile

.SILENT:
CC := gcc
CFLAGS := -Wall -Wextra -O2
# Silence some errors/warnings for now
CFLAGS += -Wno-implicit-fallthrough
CFLAGS += -Wno-strict-aliasing
CFLAGS += -Wno-uninitialized
SRC := $(wildcard *.c)
OBJ := $(SRC:.c=.o)
ELF := $(SRC:.c=.elf)
%.o: %.c
@echo CC $@
@$(CC) $(CFLAGS) -c -o $@ $<
%.elf: %.o
@echo LD $@
@$(CC) $(LIBS) -o $@ $<
all: $(ELF)
sub:
@-find . -mindepth 1 -maxdepth 1 -type d -exec make --no-print-directory -C {} \;
tags:
ctags -R .
compile_commands.json:
bear -- make
format:
clang-format -i $(shell git ls-files '*.c' '*.h')
clean:
@echo "Cleaning up..."
@rm -rf $(OBJ) $(ELF) *.json .cache
@find . -mindepth 1 -maxdepth 1 -type d -exec make --no-print-directory -C {} clean \;
.PHONY: format