CC ?= gcc CFLAGS := -Wall -Wextra -ggdb SRC := $(wildcard *.c) OBJ := $(SRC:.c=.o) ELF := $(SRC:.c=.elf) SUBDIRS += buf SUBDIRS += cjson SUBDIRS += dynbuf SUBDIRS += filters SUBDIRS += hashmap SUBDIRS += linalg SUBDIRS += lua_advanced SUBDIRS += lua_embed SUBDIRS += message SUBDIRS += socket SUBDIRS += sqlite %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< %.elf: %.o $(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: rm -rf $(OBJ) $(ELF) *.json .cache @for dir in $(SUBDIRS); do \ $(MAKE) -C $$dir clean; \ done .PHONY: format