aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2024-01-17 21:55:58 +0100
committerMarvin Borner2024-01-17 21:56:06 +0100
commit8c54dea18abacaa381f3f38c8c226dcd01757016 (patch)
tree779b76ef99646735e1206743dfe799712c2055a6
parent7bfd0540670cdf20d827dace7d720247ae3025d4 (diff)
Essential fixes
-rw-r--r--makefile14
-rw-r--r--readme.md7
2 files changed, 12 insertions, 9 deletions
diff --git a/makefile b/makefile
index 1938be4..d5ba639 100644
--- a/makefile
+++ b/makefile
@@ -7,7 +7,7 @@ TG = ctags
BUILD = ${CURDIR}/build
SRC = ${CURDIR}/src
INC = ${CURDIR}/inc
-SRCS = $(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*/*.c)
+SRCS = $(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*/*.c) $(SRC)/cmdline.c
OBJS = $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(SRCS))
CFLAGS_DEBUG = -fsanitize=leak,undefined,address -g -O0
@@ -22,13 +22,10 @@ ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
-all: genopts compile
+all: compile
full: all sync
-genopts:
- @gengetopt -i ${CURDIR}/options.ggo -G --output-dir=$(SRC)
-
compile: $(BUILD) $(OBJS) $(BUILD)/blocade
clean:
@@ -41,7 +38,12 @@ sync: # Ugly hack
@$(MAKE) $(BUILD)/blocade --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
+$(SRC)/cmdline.c:
+ @gengetopt -i ${CURDIR}/options.ggo -G --output-dir=$(BUILD)
+ @printf '%s\n%s\n%s\n%s' '#pragma GCC diagnostic push' '#pragma GCC diagnostic ignored "-Wcast-qual"' "$$(cat $(BUILD)/cmdline.c)" '#pragma GCC diagnostic pop' >$(SRC)/cmdline.c
+ @cp $(BUILD)/cmdline.h $(SRC)/cmdline.h
+
+$(BUILD)/%.o: $(SRC)/%.c | $(SRC)/cmdline.c
@mkdir -p $(@D)
@$(CC) -c -o $@ $(CFLAGS) $<
diff --git a/readme.md b/readme.md
index 514efde..6e4e686 100644
--- a/readme.md
+++ b/readme.md
@@ -4,7 +4,8 @@
binary lambda calculus (BLC).
BLoCade, the BLoC-aid, turns BLoC files back into executable files
-(targets). This is useful for [bruijn](https://bruijn.marvinborner.de),
+(targets). This is useful for [bruijn](https://bruijn.marvinborner.de)
+(see [wiki](https://bruijn.marvinborner.de/wiki/coding/compilation/)),
benchmarking, or general term optimization.
## Targets
@@ -16,8 +17,8 @@ benchmarking, or general term optimization.
- BLC (unshared): Every BLoC entry gets reinserted into the original
term. Do not use this if you want efficiency or small files. Flag
`unbblc` (bits) and `unblc` (ASCII 0/1).
-- Planned: [Effekt](https://effekt-lang.org), Scala, HVM, C, LLVM, JS,
- Haskell
+- Planned: [Effekt](https://effekt-lang.org), Scala, HVM, C, NASM,
+ LLVM, JS, Haskell
## Benchmarks