2022-11-30 16:15:12 +01:00
|
|
|
include ../config.mk
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-12-03 14:50:12 +01:00
|
|
|
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wall -Wpedantic -Iinclude -fPIC $(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-12-01 16:26:47 +01:00
|
|
|
DLL_FILE := $(LIB_PATH)/libhashset-1$(DLL_SUFFIX)
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-30 21:04:36 +01:00
|
|
|
.PHONY: all build clean test
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-12-05 00:59:45 +01:00
|
|
|
all test: clean build
|
2022-11-30 21:04:36 +01:00
|
|
|
|
2022-12-01 16:26:47 +01:00
|
|
|
build: $(ALL_PATH) $(LIB_FILE) $(DLL_FILE)
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-27 19:46:01 +01:00
|
|
|
$(LIB_FILE): $(OBJ_FILE)
|
2022-12-03 02:21:53 +01:00
|
|
|
$(AR) rcs $@ $(filter-out $(OBJ_PATH)/dll%,$^)
|
2022-12-01 16:26:47 +01:00
|
|
|
|
2022-12-03 02:21:53 +01:00
|
|
|
$(DLL_FILE): $(OBJ_FILE)
|
2022-12-01 16:26:47 +01:00
|
|
|
$(CC) $(CFLAGS) $(DLL_LDFLAGS) -o $@ $^
|
2022-11-27 19:46:01 +01:00
|
|
|
|
|
|
|
$(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-12-01 16:26:47 +01:00
|
|
|
rm -vf $(LIB_FILE) $(DLL_FILE) $(DLL_FILE).a $(OBJ_PATH)/*.o
|