diff --git a/Makefile b/Makefile index 4991382..a8d2ae4 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,9 @@ -all: release +.PHONY: all src clean -.PHONY: debug -debug: - @./tool build -d --portmidi orca +all: src -.PHONY: release -release: - @./tool build --portmidi orca - @echo "Executable program saved as: build/orca" >&2 - @echo "To run it, simply execute it:" >&2 - @echo "$$ build/orca" >&2 +src: + $(MAKE) -C src -.PHONY: clean clean: - @./tool clean + $(MAKE) -C src clean \ No newline at end of file diff --git a/Makefile.conf b/Makefile.conf new file mode 100644 index 0000000..0fc54a4 --- /dev/null +++ b/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 + diff --git a/build.conf b/build.conf new file mode 100644 index 0000000..b98e180 --- /dev/null +++ b/build.conf @@ -0,0 +1,5 @@ +# The following values reflect the defaults +PREFIX?=/opt/local +DEBUG?=1 +PORTMIDI_ENABLED?=1 +MOUSE_ENABLED?=1