aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorMarvin Borner2024-09-08 18:29:26 +0200
committerMarvin Borner2024-09-08 18:29:26 +0200
commit70179233d87c34b0f94521ba2752cda6ec77271d (patch)
treebc321d0d1ee095794f89a573b28f85722fd9a820 /makefile
parentb517b450316ffd1b6ee9cb0c25085ff3b1d4b75b (diff)
Add translation mode and statisticsHEADmain
Diffstat (limited to 'makefile')
-rw-r--r--makefile17
1 files changed, 10 insertions, 7 deletions
diff --git a/makefile b/makefile
index e755b25..0f3759b 100644
--- a/makefile
+++ b/makefile
@@ -4,17 +4,20 @@
CC = gcc
TG = ctags
+# e.g. make full DEBUG=1
+DEBUG=0
+
BUILD = ${CURDIR}/build
SRC = ${CURDIR}/src
INC = ${CURDIR}/inc
SRCS = $(wildcard $(SRC)/*.c) $(wildcard $(SRC)/impl/*.c)
OBJS = $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(SRCS))
-CFLAGS_DEBUG = -fsanitize=address,leak,undefined -g -O0
-CFLAGS_WARNINGS = -Wall -Wextra -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wunreachable-code -Wundef -Wold-style-definition -pedantic -Wno-switch-enum
+#CFLAGS_DEBUG = -fsanitize=address,leak,undefined -g -O0
+CFLAGS_WARNINGS = -Wall -Wextra -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wunreachable-code -Wundef -Wold-style-definition -pedantic -Wno-switch-enum -DDEBUG=$(DEBUG)
CFLAGS = $(CFLAGS_WARNINGS) -std=c99 -Ofast -I$(INC)
-ifdef DEBUG # TODO: Somehow clean automagically
+ifeq ($(DEBUG),1) # TODO: Somehow clean automagically
CFLAGS += $(CFLAGS_DEBUG)
endif
@@ -26,22 +29,22 @@ all: compile
full: all sync
-compile: $(BUILD) $(OBJS) $(BUILD)/blc
+compile: $(BUILD) $(OBJS) $(BUILD)/blc2blc
clean:
@rm -rf $(BUILD)/
install:
- @install -m 755 $(BUILD)/blc $(DESTDIR)$(PREFIX)/bin/
+ @install -m 755 $(BUILD)/blc2blc $(DESTDIR)$(PREFIX)/bin/
sync: # Ugly hack
- @$(MAKE) $(BUILD)/blc --always-make --dry-run | grep -wE 'gcc|g\+\+' | grep -w '\-c' | jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$$").string[1:]}]' >compile_commands.json
+ @$(MAKE) $(BUILD)/blc2blc --always-make --dry-run | grep -wE 'gcc|g\+\+' | grep -w '\-c' | jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$$").string[1:]}]' >compile_commands.json
@$(TG) -R --exclude=.git --exclude=build .
$(BUILD)/%.o: $(SRC)/%.c
@$(CC) -c -o $@ $(CFLAGS) $<
-$(BUILD)/blc: $(OBJS)
+$(BUILD)/blc2blc: $(OBJS)
@$(CC) -o $@ $(CFLAGS) $^
.PHONY: all compile clean sync