2022-11-22 23:31:21 +01:00
|
|
|
DUMPMACHINE := $(shell $(CC) -dumpmachine)
|
|
|
|
|
2022-11-25 13:36:53 +01:00
|
|
|
ifneq ($(SANITIZE_ADDRESS),1)
|
2022-11-29 15:23:06 +01:00
|
|
|
XCFLAGS = -Ofast -flto -DNDEBUG -s -static
|
2022-11-22 23:31:21 +01:00
|
|
|
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
|
2022-11-25 13:36:53 +01:00
|
|
|
XCFLAGS += -march=x86-64 -mtune=nocona
|
2022-11-22 23:31:21 +01:00
|
|
|
else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
2022-11-25 13:36:53 +01:00
|
|
|
XCFLAGS += -march=pentiumpro -mtune=intel
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
XCFLAGS = -fsanitize=address -static-libasan -g
|
2022-11-22 23:31:21 +01:00
|
|
|
endif
|
|
|
|
|
2022-11-25 13:36:53 +01:00
|
|
|
ifneq ($(firstword $(filter %-mingw32 %-cygwin,$(DUMPMACHINE))),)
|
|
|
|
EXE_SUFFIX := .exe
|
2022-11-22 23:31:21 +01:00
|
|
|
ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
|
|
|
XCFLAGS += -Wl,--large-address-aware
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2022-11-25 13:36:53 +01:00
|
|
|
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -I../libhashset/include $(XCFLAGS)
|
2022-11-22 23:31:21 +01:00
|
|
|
|
|
|
|
SRC_PATH := src
|
|
|
|
BIN_PATH := bin
|
2022-11-27 19:46:01 +01:00
|
|
|
ALL_PATH := $(SRC_PATH) $(BIN_PATH)
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-25 16:58:37 +01:00
|
|
|
BIN_FILE := $(BIN_PATH)/hashset-test$(EXE_SUFFIX)
|
2022-11-29 15:23:06 +01:00
|
|
|
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
2022-11-22 23:31:21 +01:00
|
|
|
LIB_FILE := ../libhashset/lib/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) $(BIN_FILE)
|
2022-11-22 23:31:21 +01:00
|
|
|
|
2022-11-27 19:46:01 +01:00
|
|
|
$(BIN_FILE): $(SRC_FILE) $(LIB_FILE)
|
2022-11-28 17:46:49 +01:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^
|
2022-11-27 19:46:01 +01:00
|
|
|
|
|
|
|
$(ALL_PATH):
|
2022-11-22 23:31:21 +01:00
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(BIN_FILE)
|