Added debug / default build options (make debug)

This commit is contained in:
frekky 2015-09-28 12:24:15 +08:00
parent 0449c465e7
commit c48822dfbe
2 changed files with 14 additions and 2 deletions

View File

@ -18,6 +18,9 @@ TARGETOS = `uname`
all:
@(cd src; $(MAKE) TARGETOS=$(TARGETOS) all)
debug:
@(cd src; $(MAKE) TARGETOS=$(TARGETOS) debug)
install: all
$(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(sbindir)

View File

@ -10,9 +10,18 @@ HEAD_COMMIT = `git rev-parse --short HEAD`
LIBPATH = -L.
LDFLAGS += -lz `sh osflags $(TARGETOS) link` $(LIBPATH)
CFLAGS += -std=c99 -c -g -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags` -DGITREVISION=\"$(HEAD_COMMIT)\"
CFLAGS += -std=c99 -c -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags` -DGITREVISION=\"$(HEAD_COMMIT)\"
all: stateos $(CLIENT) $(SERVER)
CFLAGS_RELEASE = -O3 -fno-strict-aliasing
CFLAGS_DEBUG = -g -Og -DDEBUG_BUILD
all: CFLAGS += $(CFLAGS_RELEASE)
all: executables
debug: CFLAGS += $(CFLAGS_DEBUG)
debug: executables
executables: stateos $(CLIENT) $(SERVER)
stateos:
@echo OS is $(OS), arch is $(ARCH)