41 lines
754 B
Makefile
41 lines
754 B
Makefile
CC = gcc
|
|
CFLAGS = -g -MD -MP -Wall -Wextra
|
|
|
|
TARGET = build/stored
|
|
|
|
SRC := $(wildcard src/*.c)
|
|
OBJ := $(patsubst src/%.c,build/%.o,$(SRC))
|
|
INC = ./include ../shared/include ./deps
|
|
|
|
HDR_FLG = $(foreach D, $(INC), -I$(D))
|
|
DEP_FILES = $(wildcard build/*.d)
|
|
|
|
all: $(TARGET)
|
|
|
|
# link step
|
|
$(TARGET): $(OBJ)
|
|
@mkdir -p build
|
|
$(CC) $(CFLAGS) -o $@ $^
|
|
|
|
# compile step
|
|
build/%.o: src/%.c
|
|
@mkdir -p build
|
|
$(CC) $(CFLAGS) $(HDR_FLG) -c $< -o $@
|
|
|
|
clean:
|
|
rm -rf build
|
|
|
|
re: clean all
|
|
|
|
run: all
|
|
@./$(TARGET)
|
|
|
|
cloc:
|
|
@cloc --exclude-ext=d,json --fullpath --not-match-d='(.*)deps(.*)' .
|
|
|
|
monitor:
|
|
@watch -t -n 0.1 "ls /dev/mqueue/ /tmp /dev/shm | grep -E 'store|:' && echo tcp: && ss -tlnp | grep store"
|
|
|
|
-include $(DEP_FILES)
|
|
.PHONY: all clean re run cloc monitor
|