diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-04-27 22:27:18 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-04-27 22:27:18 +0200 |
commit | 205de25237f5cd88f55f6a5f4264f65a4f1cbc6f (patch) | |
tree | 07b346630d744479906cb27e7927140f105dc999 | |
parent | ca35292bf9eb91f75630c577990a581cba4a30ad (diff) |
Simplify macros and define _GNU_SOURCE on Glibc
-rw-r--r-- | make.c | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -1,5 +1,8 @@ #define _GNU_SOURCE #include <errno.h> +#if __has_include(<features.h>) +# include <features.h> +#endif #include <glob.h> #include <stdlib.h> #include <string.h> @@ -8,20 +11,29 @@ #define CBS_PTHREAD #include "cbs.h" -#define CC "gcc" -#define CFLAGS_ALL WARNINGS, "-pipe", "-std=c23", "-Iinclude" -#define CFLAGS_DBG CFLAGS_ALL, "-g", "-ggdb3", "-Og" -#ifdef __APPLE__ -# define CFLAGS_RLS CFLAGS_ALL, "-O3", "-flto", "-DNDEBUG" -#else -# define CFLAGS_RLS \ - CFLAGS_ALL, "-O3", "-flto", "-DNDEBUG", "-march=native", "-mtune=native" -#endif +#define CC "gcc" #define LIBNAME "libmlib" + +#define CFLAGS_ALL WARNINGS, "-pipe", "-std=c23", "-Iinclude" GLIB_EXTRAS +#define CFLAGS_DBG CFLAGS_ALL, "-g", "-ggdb3", "-Og" +#define CFLAGS_RLS CFLAGS_ALL, "-O3", "-flto", "-DNDEBUG" NOT_APPLE_EXTRAS + #define WARNINGS \ "-Wall", "-Wextra", "-Wpedantic", "-Werror", "-Wno-attributes", "-Wvla", \ "-Wno-pointer-sign", "-Wno-parentheses" +#ifdef __GLIBC__ +# define GLIB_EXTRAS , "-D_GNU_SOURCE" +#else +# define GLIB_EXTRAS +#endif + +#ifndef __APPLE__ +# define NOT_APPLE_EXTRAS , "-march=native", "-mtune=native" +#else +# define NOT_APPLE_EXTRAS +#endif + #define CMDRC(c) \ do { \ int ec; \ |