Browse Source

Build: Add GNU Make based build infrastructure

Currently covers:
* the build options (minus hardening) of the "tool" (original shell build script)
* clang
* macos
master
heck 2 years ago
parent
commit
ad58c2fc9b
  1. 17
      Makefile
  2. 67
      Makefile.conf
  3. 5
      build.conf

17
Makefile

@ -1,16 +1,9 @@
all: release .PHONY: all src clean
.PHONY: debug all: src
debug:
@./tool build -d --portmidi orca
.PHONY: release src:
release: $(MAKE) -C src
@./tool build --portmidi orca
@echo "Executable program saved as: build/orca" >&2
@echo "To run it, simply execute it:" >&2
@echo "$$ build/orca" >&2
.PHONY: clean
clean: clean:
@./tool clean $(MAKE) -C src clean

67
Makefile.conf

@ -0,0 +1,67 @@
TARGET=tui_main
LANG_VERSION=c99
# Build option defaults
PREFIX?=/opt/local
DEBUG?=1
PORTMIDI_ENABLED?=1
MOUSE_ENABLED?=1
CFLAGS+=\
-finput-charset=UTF-8 \
-Wall \
-Wpedantic \
-Wextra \
-Wwrite-strings \
-Wconversion \
-Wshadow \
-Wstrict-prototypes \
-Werror=implicit-function-declaration \
-Werror=implicit-int \
-Werror=incompatible-pointer-types \
-Werror=int-conversion \
-Wno-missing-field-initializers \
-DORCA_OS_MAC \
-D_XOPEN_SOURCE_EXTENDED=1 \
-march=nehalem \
-fcolor-diagnostics
LDFLAGS_NCURSES=$(shell pkg-config --libs ncursesw formw)
LDFLAGS+=$(LDFLAGS_NCURSES)
######### Overrides from build.conf #########
HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
-include $(HERE)build.conf
CFLAGS+=-std=$(LANG_VERSION)
CFLAGS+=-I$(PREFIX)/include
LDFLAGS+=-L$(PREFIX)/lib
ifeq ($(DEBUG),1)
CFLAGS+=\
-g \
-O0 \
-DDEBUG \
# -fsanitize=address \
# -fsanitize=undefined \
# -fsanitize=float-divide-by-zero \
# -fsanitize=implicit-conversion \
# -fsanitize=unsigned-integer-overflow
else
CFLAGS+=\
-DNDEBUG \
-O2 \
-g0
endif
ifeq ($(PORTMIDI_ENABLED),1)
LDFLAGS+= -lportmidi
CFLAGS+= -DFEAT_PORTMIDI
endif
ifeq ($(MOUSE_ENABLED),0)
CFLAGS+=-DFEAT_NOMOUSE
endif

5
build.conf

@ -0,0 +1,5 @@
# The following values reflect the defaults
PREFIX?=/opt/local
DEBUG?=1
PORTMIDI_ENABLED?=1
MOUSE_ENABLED?=1
Loading…
Cancel
Save