diff options
author | Test_User <hax@andrewyu.org> | 2024-03-16 06:55:42 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2024-03-16 06:55:42 -0400 |
commit | 659f0d647ca27d03815e799f74e1023fa5f3bc25 (patch) | |
tree | 1c12847f2689bb334acaec13637cbca7b7c5afea | |
parent | 74c0da6f69af63a53fbd01e2c574b48cfaa53826 (diff) | |
download | coupserv-659f0d647ca27d03815e799f74e1023fa5f3bc25.tar.gz coupserv-659f0d647ca27d03815e799f74e1023fa5f3bc25.zip |
backport makefile improvements to current haxserv (from next in-progress haxserv)
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 56 |
2 files changed, 52 insertions, 5 deletions
@@ -3,3 +3,4 @@ config.c .*.swp haxserv core +.makeopts @@ -28,6 +28,54 @@ #INCLUDEFLAGS = +CFLAGS += $(INCLUDEFLAGS) -D_REENTRANT -ggdb3 -Wall -Wextra -Wsign-conversion -Wno-unused-parameter $(shell pkg-config gnutls --cflags) + +LDFLAGS = -lpthread $(shell pkg-config gnutls --libs) + +.makeopts: + @printf '%s\n' 'LAST_VERBOSE = 1' > .makeopts + @printf '%s\n' 'LAST_COLORIZE = 1' >> .makeopts + @printf '%s\n' 'LAST_SAFE_STACK = 0' >> .makeopts + +include .makeopts + +rebuild = 0 + +#tabs not allowed :( +ifneq ($(VERBOSE),) +ifneq ($(VERBOSE),$(LAST_VERBOSE)) +rebuild = 1 +endif +else +VERBOSE = $(LAST_VERBOSE) +endif + +ifneq ($(COLORIZE),) +ifneq ($(COLORIZE),$(LAST_COLORIZE)) +rebuild = 1 +endif +else +COLORIZE = $(LAST_COLORIZE) +endif + +ifneq ($(SAFE_STACK),) +ifneq ($(SAFE_STACK),$(LAST_SAFE_STACK)) +rebuild = 1 +endif +else +SAFE_STACK = $(LAST_SAFE_STACK) +endif + +ifeq ($(rebuild),1) +$(shell printf '%s%s\n' 'LAST_VERBOSE = ' $(VERBOSE) > .makeopts) +$(shell printf '%s%s\n' 'LAST_COLORIZE = ' $(COLORIZE) >> .makeopts) +$(shell printf '%s%s\n' 'LAST_SAFE_STACK = ' $(SAFE_STACK) >> .makeopts) + +$(shell $(RM) haxserv *.o) +endif + +DEPS = $(shell $(CC) $(INCLUDEFLAGS) -MM -MT $(1).o $(1).c | sed -z 's/\\\n //g') + ifeq ($(VERBOSE), 1) CFLAGS += -DLOGALL=1 endif @@ -36,11 +84,9 @@ ifeq ($(COLORIZE), 1) CFLAGS += -DCOLORIZE=1 endif -CFLAGS += $(INCLUDEFLAGS) -D_REENTRANT -ggdb3 -Wall -Wextra -Wsign-conversion -Wno-unused-parameter $(shell pkg-config gnutls --cflags) - -LDFLAGS = -lpthread $(shell pkg-config gnutls --libs) - -DEPS = $(shell $(CC) $(INCLUDEFLAGS) -MM -MT $(1).o $(1).c | sed -z 's/\\\n //g') +ifeq ($(SAFE_STACK), 1) + CFLAGS += -fstack-check +endif .PHONY: all clean cleanall release all: haxserv |