LibHashSet/test/Makefile

45 lines
1.0 KiB
Makefile
Raw Normal View History

DUMPMACHINE := $(shell $(CC) -dumpmachine)
2022-11-25 13:36:53 +01:00
ifneq ($(SANITIZE_ADDRESS),1)
XCFLAGS = -Ofast -flto -DNDEBUG -s -static
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
2022-11-25 13:36:53 +01:00
XCFLAGS += -march=x86-64 -mtune=nocona
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
endif
2022-11-25 13:36:53 +01:00
ifneq ($(firstword $(filter %-mingw32 %-cygwin,$(DUMPMACHINE))),)
EXE_SUFFIX := .exe
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)
SRC_PATH := src
BIN_PATH := bin
ALL_PATH := $(SRC_PATH) $(BIN_PATH)
2022-11-25 16:58:37 +01:00
BIN_FILE := $(BIN_PATH)/hashset-test$(EXE_SUFFIX)
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
LIB_FILE := ../libhashset/lib/libhashset-1.a
.PHONY: all build clean
all: clean build
build: $(ALL_PATH) $(BIN_FILE)
$(BIN_FILE): $(SRC_FILE) $(LIB_FILE)
$(CC) $(CFLAGS) -o $@ $^
$(ALL_PATH):
mkdir -p $@
clean:
rm -f $(BIN_FILE)