aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-06-06 18:10:14 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-06-06 18:10:14 -0700
commit069415a78b5b97cd0d0accf7a925f7f599f7458c (patch)
tree5e24e4600815574ceb67d6ae06289e87a838e090 /Makefile
parent380f2a8ab0af67164e4b6170073bf2953e5d6765 (diff)
Reworked a bunch of the config option stuff for picking files and user
input. Now that stuff is handled with makefile flags.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 27 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 1f2c13e..d07f1b4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,31 +1,50 @@
+NAME=bb
PREFIX=
CC=gcc
CFLAGS=-O0 -std=gnu99 -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L
CWARN= -Wall -Wpedantic -Wno-unknown-pragmas -fsanitize=address -fno-omit-frame-pointer
-UNAME := $(shell uname)
-ifeq ($(UNAME),Darwin)
+G=-g
+PICK=
+ASK=
+ASKECHO=
+
+ifeq ($(shell uname),Darwin)
CFLAGS += -D_DARWIN_C_SOURCE
CWARN += -Weverything -Wno-missing-field-initializers -Wno-padded\
-Wno-missing-noreturn -Wno-cast-qual
endif
-LIBS=
-NAME=bb
-G=-g
ifneq (, $(shell which ask))
-CFLAGS += -D'ASKECHO(prompt,...)="ask " ## __VA_ARGS__ " \"" prompt "\""' -D'FUZZY(prompt,...)="ask " ## __VA_ARGS__ " \"" prompt "\""'
+ifeq (, $(ASKECHO)$(ASK))
+ASKECHO="ask --prompt=\"" prompt "\" --query=\"" initial "\""
+endif
+ifeq (, $(PICK))
+PICK="ask --prompt=\"" prompt "\" --query=\"" initial "\""
+endif
+endif
+
+ifneq (, $(ASKECHO))
+CFLAGS += -D'ASKECHO(prompt,initial)=$(ASKECHO)'
+endif
+
+ifneq (, $(ASK))
+CFLAGS += -D'ASK(var,prompt,initial)=$(ASK)'
+endif
+
+ifneq (, $(PICK))
+CFLAGS += -D'PICK(prompt, initial)=$(PICK)'
endif
all: $(NAME)
clean:
- rm $(NAME)
+ rm -f $(NAME)
config.h:
cp config.def.h config.h
$(NAME): $(NAME).c bterm.h config.h
- $(CC) $(NAME).c $(LIBS) $(CFLAGS) $(CWARN) $(G) -o $(NAME)
+ $(CC) $(NAME).c $(CFLAGS) $(CWARN) $(G) -o $(NAME)
install: $(NAME)
@prefix="$(PREFIX)"; \