Some of these are dependent on libraries that might not always be available on all machines.
58 lines
969 B
Makefile
58 lines
969 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)
|
|
|
|
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
|
|
@echo CC $@
|
|
@$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
%.elf: %.o
|
|
@echo LD $@
|
|
@$(CC) $(LIBS) -o $@ $<
|
|
|
|
all: $(ELF)
|
|
# @for dir in $(SUBDIRS); do \
|
|
# $(MAKE) -C $$dir; \
|
|
# done
|
|
|
|
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
|