summaryrefslogtreecommitdiff
path: root/Makefile
blob: fa0c5052e0149653568935d0652f4fc9a3695987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
CC := gcc
CFLAGS := -Wall -Wextra -std=c11 -O2 -fwrapv
BIN := bfcomp
SNIPPETS := $(wildcard *.snippet.asm)
SNIPPETHEADERS := $(patsubst %.asm,%.asm.h,$(SNIPPETS))

.PHONY: all clean remake

all: $(BIN)

clean:
	rm -rf $(BIN) *.asm.h *.dSYM

remake: clean all


$(BIN): $(wildcard *.c *.h) $(SNIPPETHEADERS)
	$(CC) $(CFLAGS) -o $@ $(filter-out %.h,$^)

%.asm.h: %.asm
	(printf '#pragma once\n\n'; xxd -i $^ | sed 's/[0-9a-f]$$/&, 0x00/' | sed 's/unsigned //g') >$@