36 lines
620 B
Makefile
36 lines
620 B
Makefile
|
|
CC = gcc
|
|
|
|
CFLAGS = \
|
|
-std=c17 \
|
|
-Wall \
|
|
-Wextra \
|
|
-Wpedantic \
|
|
-Wconversion \
|
|
-Iinclude
|
|
|
|
all: compile_flags.txt dirs scirpt
|
|
|
|
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
|
|
SCIRPT_OBJ = $(patsubst %.c, build/scirpt/%.o, $(SCIRPT_SRC))
|
|
|
|
scirpt: $(SCIRPT_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/
|
|
|