Some Makefile improvements.

This commit is contained in:
LoRd_MuldeR 2022-11-25 13:36:53 +01:00
parent 4dfc5f5279
commit 5675964db1
4 changed files with 31 additions and 14 deletions

View File

@ -1,9 +1,16 @@
SUBDIRS := libhashset hashset
.PHONY: all clean
BUILD_ALL := $(patsubst %,build_rule\:%,$(SUBDIRS))
CLEAN_ALL := $(patsubst %,clean_rule\:%,$(SUBDIRS))
all:
for subdir in $(SUBDIRS); do $(MAKE) -C $$subdir; done
.PHONY: all clean $(BUILD_ALL) $(CLEAN_ALL)
clean:
for subdir in $(SUBDIRS); do $(MAKE) -C $$subdir clean; done
all: $(BUILD_ALL)
clean: $(CLEAN_ALL)
$(BUILD_ALL):
$(MAKE) -C $(patsubst build_rule:%,%,$@)
$(CLEAN_ALL):
$(MAKE) -C $(patsubst clean_rule:%,%,$@) clean

View File

@ -1,19 +1,24 @@
DUMPMACHINE := $(shell $(CC) -dumpmachine)
ifneq ($(SANITIZE_ADDRESS),1)
XCFLAGS = -O3 -DNDEBUG
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
XCFLAGS = -march=x86-64 -mtune=nocona -s
XCFLAGS += -march=x86-64 -mtune=nocona
else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
XCFLAGS = -march=pentiumpro -mtune=intel -s
XCFLAGS += -march=pentiumpro -mtune=intel
endif
else
XCFLAGS = -fsanitize=address -static-libasan -g
endif
ifeq ($(OS),Windows_NT)
ifneq ($(firstword $(filter %-mingw32 %-cygwin,$(DUMPMACHINE))),)
EXE_SUFFIX := .exe
ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
XCFLAGS += -Wl,--large-address-aware
endif
EXE_SUFFIX := .exe
endif
CFLAGS = -std=c99 -O3 -DNDEBUG -D_DEFAULT_SOURCE -Wpedantic -I../libhashset/include $(XCFLAGS)
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -I../libhashset/include $(XCFLAGS)
SRC_PATH := src
BIN_PATH := bin

View File

@ -326,7 +326,7 @@ static int test_function_3(hash_set_t *const hash_set)
/* TEST #4 */
/* ========================================================================= */
#define LIMIT (UINT64_MAX >> 2)
#define LIMIT (((uint64_t)UINT32_MAX) >> 2)
static int test_function_4(hash_set_t *const hash_set)
{

View File

@ -1,12 +1,17 @@
DUMPMACHINE := $(shell $(CC) -dumpmachine)
ifneq ($(SANITIZE_ADDRESS),1)
XCFLAGS = -O3 -DNDEBUG
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
XCFLAGS = -march=x86-64 -mtune=nocona
XCFLAGS += -march=x86-64 -mtune=nocona
else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
XCFLAGS = -march=pentiumpro -mtune=intel
XCFLAGS += -march=pentiumpro -mtune=intel
endif
else
XCFLAGS = -fsanitize=address -static-libasan -g
endif
CFLAGS = -std=c99 -O3 -DNDEBUG -Wpedantic -Iinclude $(XCFLAGS)
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -Iinclude $(XCFLAGS)
SRC_PATH := src
OBJ_PATH := obj