CC = gcc CFLAGS = \ -std=c17 \ -Wall \ -Wextra \ -Wpedantic \ -Wconversion \ -Iinclude # CFLAGS += -O3 CFLAGS += -g all: compile_flags.txt dirs scirpt lommereimar COMMON_SRC = string.c stringmap.c COMMON_OBJ = $(patsubst %.c, build/common/%.o, $(COMMON_SRC)) SCIRPT_SRC = main.c lexer.c ast.c parser.c compiler.c SCIRPT_OBJ = $(patsubst %.c, build/scirpt/%.o, $(SCIRPT_SRC)) scirpt: $(SCIRPT_OBJ) $(COMMON_OBJ) $(CC) -o bin/$@ $(CFLAGS) $^ -lm LOMMEREIMAR_SRC = calculator.c LOMMEREIMAR_OBJ = $(patsubst %.c, build/lommereimar/%.o, $(LOMMEREIMAR_SRC)) lommereimar: $(LOMMEREIMAR_OBJ) $(COMMON_OBJ) $(CC) -o bin/$@ $(CFLAGS) $^ -lm CHP_SRC = chp.c CHP_OBJ = $(patsubst %.c, build/chp/%.o, $(LOMMEREIMAR_SRC)) chp: $(CHP_OBJ) $(COMMON_OBJ) $(CC) -o bin/$@ $(CFLAGS) $^ -lm build/%.o: %.c $(shell find -name *.h) mkdir $(@D) -p $(CC) -c -o $@ $(CFLAGS) $< dirs: mkdir -p bin compile_flags.txt: echo -xc $(CFLAGS) | sed 's/\s\+/\n/g' > compile_flags.txt clean: rm -rf build/ bin/