24 lines
405 B
Makefile
24 lines
405 B
Makefile
TARGET_LIB ?= libqments.a
|
|
|
|
BD ?= build
|
|
SRC_DIRS ?= src
|
|
INCLUDE_DIRS ?= include
|
|
|
|
SRC_FILES := $(shell find $(SRC_DIRS) -name *.c)
|
|
OBJ_FILES := $(patsubst %.c,$(BD)/%.o,$(SRC_FILES))
|
|
|
|
$(BD)/$(TARGET_LIB): $(OBJ_FILES)
|
|
mkdir -p $(@D)
|
|
ar rcs $@ $(OBJ_FILES)
|
|
|
|
$(BD)/%.o: %.c
|
|
mkdir -p $(@D)
|
|
$(CC) $(CFLAGS) -c $< -o $@ -I $(INCLUDE_DIRS)
|
|
|
|
all: $(BD)/$(TARGET_LIB)
|
|
|
|
clean:
|
|
rm -rfI $(BD)/
|
|
|
|
.PHONY: all clean
|