2022-11-30 16:15:12 +01:00
|
|
|
include ../config.mk
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-25 13:36:53 +01:00
|
|
|
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -Iinclude $(XCFLAGS)
|
2022-11-22 23:31:21 +01:00
|
|
|
|
|
|
|
SRC_PATH := src
|
|
|
|
OBJ_PATH := obj
|
|
|
|
LIB_PATH := lib
|
2022-11-27 19:46:01 +01:00
|
|
|
ALL_PATH := $(SRC_PATH) $(OBJ_PATH) $(LIB_PATH)
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-27 19:46:01 +01:00
|
|
|
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
|
|
|
OBJ_FILE := $(addprefix $(OBJ_PATH)/,$(patsubst %.c,%.o,$(notdir $(SRC_FILE))))
|
2022-11-22 23:31:21 +01:00
|
|
|
LIB_FILE := $(LIB_PATH)/libhashset-1.a
|
|
|
|
|
2022-11-27 19:46:01 +01:00
|
|
|
.PHONY: all build clean
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-27 19:46:01 +01:00
|
|
|
all: clean build
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-27 19:46:01 +01:00
|
|
|
build: $(ALL_PATH) $(LIB_FILE)
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-27 19:46:01 +01:00
|
|
|
$(LIB_FILE): $(OBJ_FILE)
|
|
|
|
$(AR) rcs $@ $(OBJ_FILE)
|
|
|
|
|
|
|
|
$(OBJ_FILE):
|
2022-11-22 23:31:21 +01:00
|
|
|
$(CC) $(CFLAGS) -c $(SRC_PATH)/$(patsubst %.o,%.c,$(notdir $@)) -o $@
|
|
|
|
|
2022-11-27 19:46:01 +01:00
|
|
|
$(ALL_PATH):
|
2022-11-22 23:31:21 +01:00
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
clean:
|
2022-11-27 19:46:01 +01:00
|
|
|
rm -vf $(LIB_FILE) $(OBJ_PATH)/*.o
|