diff --git a/GNUmakefile b/GNUmakefile index 072089a..e2dcb82 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -49,7 +49,7 @@ PPO_AR = AR PPO_LD = LD # Dependencies -CHECKDEPS = mkdir mkfifo gcc ar cargo jq +CHECKDEPS = mkdir mkfifo $(CC) ar cargo jq # Directories SRC_DIR = src @@ -82,6 +82,11 @@ ifndef MAKEFLAGS_JOBS CARGO_JOBS = -j1 endif CC = gcc +ifeq ($(shell uname), Darwin) + CC = clang + MACOS_SPECIFIC_CFLAGS_OPTS = -x objective-c + MACOS_SPECIFIC_LDFLAGS_OPTS = -framework Cocoa -framework Carbon -framework CoreVideo -framework OpenGL -framework IOKit +endif AR = ar -rc ifdef Q_RSC CARGO_QUIET_OPTS = -q --message-format=json @@ -95,8 +100,19 @@ else RSC += -r DISABLE_ASSERTS_OPTS = -D NDEBUG HIDE_WARNS_OPTS = -w - RELEASE_OPTS = -pipe -O3 -fipa-pta - STRIP_OPTS = -s + RELEASE_OPTS = -pipe -O3 + ifeq ($(CC), gcc) + RELEASE_OPTS += -fipa-pta + endif + ifneq ($(shell uname), Darwin) + STRIP_OPTS = -s + endif +endif +ifeq ($(CC), gcc) + GCC_STATIC_LDFLAGS_OPTS = -static-libgcc +endif +ifneq ($(shell uname), Darwin) + BUILDID_OPTS = -Wl,--build-id endif define RAYLIB_CPPFLAGS $(DISABLE_ASSERTS_OPTS) \ @@ -116,7 +132,8 @@ define RAYLIB_CFLAGS -std=gnu99 \ $(HIDE_WARNS_OPTS) \ $(DEBUG_SYM_OPTS) \ - $(RELEASE_OPTS) + $(RELEASE_OPTS) \ + $(MACOS_SPECIFIC_CFLAGS_OPTS) endef define CFLAGS -std=c11 \ @@ -125,19 +142,21 @@ define CFLAGS -pedantic \ -Werror \ $(DEBUG_SYM_OPTS) \ - $(RELEASE_OPTS) + $(RELEASE_OPTS) \ + $(MACOS_SPECIFIC_CFLAGS_OPTS) endef define LDFLAGS - -Wl,--build-id \ - $(STRIP_OPTS) \ - $(RELEASE_OPTS) \ - -L $(BUILD_DIR) \ - -L $(LAUNCHER_BUILD_DIR) \ - -lraylib \ - -lsk_launcher \ - -lpthread \ - -lm \ - -static-libgcc + $(BUILDID_OPTS) \ + $(STRIP_OPTS) \ + $(RELEASE_OPTS) \ + -L $(BUILD_DIR) \ + -L $(LAUNCHER_BUILD_DIR) \ + -lraylib \ + -lsk_launcher \ + -lpthread \ + -lm \ + $(GCC_STATIC_LDFLAGS_OPTS) \ + $(MACOS_SPECIFIC_LDFLAGS_OPTS) endef # Build output diff --git a/README.org b/README.org index 39c3451..9e8926c 100644 --- a/README.org +++ b/README.org @@ -110,6 +110,7 @@ You should have received a copy of the GNU General Public License along with Spa - [[#gentoo][Gentoo]] - [[#freebsd][FreeBSD]] - [[#openbsd][OpenBSD]] + - [[#macos][macOS]] * Project's Roadmap @@ -200,3 +201,9 @@ sudo pkg install gmake gcc rust jq libX11 libXcursor libXrandr libXinerama libXi sudo pkg_add gmake gcc rust jq sudo ln -s /usr/local/bin/x86_64-unknown-openbsd*-gcc-* /usr/local/bin/gcc #+end_src + +*** macOS + +#+begin_src sh +brew install rust jq +#+end_src diff --git a/src/sk_server.c b/src/sk_server.c index 26be252..18c1f5f 100644 --- a/src/sk_server.c +++ b/src/sk_server.c @@ -40,7 +40,6 @@ #endif static volatile u8 running = 1; -static volatile u8 clients = 0; static inline void handle_interrupt(i32 signum) { if (signum == SIGINT) running = 0;