diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-01-29 16:24:44 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-01-29 16:24:44 -0500 |
commit | 08fa9bdae7e550666d5bc6ca7d089f70bd7f3cf1 (patch) | |
tree | 1c4ff9c873176f6096597875f8141f3af42c21eb | |
parent | e89b125d341c9ade21a6aef97ea5ed8aa3084c93 (diff) | |
download | bfs-08fa9bdae7e550666d5bc6ca7d089f70bd7f3cf1.tar.xz |
Standardize WITH_* make variables for configuring dependencies
-rw-r--r-- | Makefile | 59 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | expr.h | 2 | ||||
-rw-r--r-- | parse.c | 2 | ||||
-rw-r--r-- | regex.h (renamed from regexp.h) | 16 | ||||
-rw-r--r-- | util.c | 2 | ||||
-rw-r--r-- | util.h | 3 |
7 files changed, 54 insertions, 32 deletions
@@ -64,38 +64,64 @@ LOCAL_CFLAGS := -std=c99 LOCAL_LDFLAGS := LOCAL_LDLIBS := -ASAN_CFLAGS := -fsanitize=address -MSAN_CFLAGS := -fsanitize=memory -fsanitize-memory-track-origins -UBSAN_CFLAGS := -fsanitize=undefined +ASAN := $(filter asan,$(MAKECMDGOALS)) +MSAN := $(filter msan,$(MAKECMDGOALS)) +UBSAN := $(filter ubsan,$(MAKECMDGOALS)) ifeq ($(OS),Linux) -LOCAL_LDFLAGS += -Wl,--as-needed -LOCAL_LDLIBS += -lacl -lcap -lattr -lrt +ifndef MSAN # These libraries are not built with msan +WITH_ACL := y +WITH_ATTR := y +WITH_LIBCAP := y +endif -# These libraries are not built with msan, so disable them -MSAN_CFLAGS += -DBFS_HAS_SYS_ACL=0 -DBFS_HAS_SYS_CAPABILITY=0 -DBFS_HAS_SYS_XATTR=0 +ifdef WITH_ACL +LOCAL_LDLIBS += -lacl +else +LOCAL_CFLAGS += -DBFS_HAS_SYS_ACL=0 +endif -DISTCHECK_FLAGS := TEST_FLAGS="--verbose --all --sudo" +ifdef WITH_ATTR +LOCAL_LDLIBS += -lattr else +LOCAL_CFLAGS += -DBFS_HAS_SYS_XATTR=0 +endif + +ifdef WITH_LIBCAP +LOCAL_LDLIBS += -lcap +else +LOCAL_CFLAGS += -DBFS_HAS_SYS_CAPABILITY=0 +endif + +LOCAL_LDFLAGS += -Wl,--as-needed +LOCAL_LDLIBS += -lrt + +DISTCHECK_FLAGS := TEST_FLAGS="--verbose --all --sudo" +else # Linux DISTCHECK_FLAGS := TEST_FLAGS="--verbose" endif +ifdef WITH_ONIGURUMA +LOCAL_LDLIBS += -lonig +LOCAL_CFLAGS += -DBFS_WITH_ONIGURUMA=1 +endif + ifeq ($(OS),NetBSD) LOCAL_LDLIBS += -lutil endif -ifneq ($(filter asan,$(MAKECMDGOALS)),) -LOCAL_CFLAGS += $(ASAN_CFLAGS) +ifdef ASAN +LOCAL_CFLAGS += -fsanitize=address SANITIZE := y endif -ifneq ($(filter msan,$(MAKECMDGOALS)),) -LOCAL_CFLAGS += $(MSAN_CFLAGS) +ifdef MSAN +LOCAL_CFLAGS += -fsanitize=memory -fsanitize-memory-track-origins SANITIZE := y endif -ifneq ($(filter ubsan,$(MAKECMDGOALS)),) -LOCAL_CFLAGS += $(UBSAN_CFLAGS) +ifdef UBSAN +LOCAL_CFLAGS += -fsanitize=undefined SANITIZE := y endif @@ -111,11 +137,6 @@ ifneq ($(filter release,$(MAKECMDGOALS)),) CFLAGS := $(DEFAULT_CFLAGS) -O3 -flto -DNDEBUG endif -ifeq ($(USE_ONIGURUMA),1) -LOCAL_LDLIBS += -lonig -LOCAL_CFLAGS += -DBFS_USE_ONIGURUMA=1 -endif - ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS) ALL_CFLAGS = $(ALL_CPPFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) $(DEPFLAGS) ALL_LDFLAGS = $(ALL_CFLAGS) $(LOCAL_LDFLAGS) $(LDFLAGS) @@ -37,7 +37,7 @@ #include "time.h" #include "trie.h" #include "util.h" -#include "regexp.h" +#include "regex.h" #include <assert.h> #include <errno.h> #include <fcntl.h> @@ -25,7 +25,7 @@ #include "eval.h" #include "exec.h" #include "printf.h" -#include "regexp.h" +#include "regex.h" #include "stat.h" #include <stdbool.h> #include <stddef.h> @@ -41,7 +41,7 @@ #include "time.h" #include "typo.h" #include "util.h" -#include "regexp.h" +#include "regex.h" #include <assert.h> #include <errno.h> #include <fcntl.h> @@ -1,7 +1,7 @@ /**************************************************************************** * bfs * - * Copyright (C) 2022 Tavian Barnes <tavianator@tavianator.com> and * - * BFS contributors * + * Copyright (C) 2022 Tavian Barnes <tavianator@tavianator.com> and bfs * + * contributors * * * * Permission to use, copy, modify, and/or distribute this software for any * * purpose with or without fee is hereby granted. * @@ -15,13 +15,13 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ****************************************************************************/ -#ifndef BFS_REGEXP_H -#define BFS_REGEXP_H +#ifndef BFS_REGEX_H +#define BFS_REGEX_H -#if BFS_USE_ONIGURUMA == 1 - #include <onigposix.h> +#if BFS_WITH_ONIGURUMA +# include <onigposix.h> #else - #include <regex.h> +# include <regex.h> #endif -#endif // BFS_REGEXP_H +#endif // BFS_REGEX_H @@ -16,7 +16,7 @@ #include "util.h" #include "dstring.h" -#include "regexp.h" +#include "regex.h" #include <assert.h> #include <errno.h> #include <fcntl.h> @@ -20,7 +20,8 @@ #ifndef BFS_UTIL_H #define BFS_UTIL_H -#include "regexp.h" + +#include "regex.h" #include <fcntl.h> #include <fnmatch.h> #include <stdbool.h> |