2023-09-08 20:42:06 +00:00
|
|
|
# Interface:
|
|
|
|
# make
|
|
|
|
# make build
|
|
|
|
# make format
|
|
|
|
|
|
|
|
# Compiler
|
|
|
|
CC=gcc
|
|
|
|
# CC=tcc # <= faster compilation
|
|
|
|
|
|
|
|
# Main file
|
2023-09-10 13:05:28 +00:00
|
|
|
SRC=lc.c
|
|
|
|
OUT=lc
|
2023-09-08 20:42:06 +00:00
|
|
|
|
|
|
|
## Flags
|
|
|
|
DEBUG= #'-g'
|
|
|
|
STANDARD=-std=c99
|
|
|
|
WARNINGS=-Wall
|
2023-09-09 09:01:04 +00:00
|
|
|
OPTIMIZED=-O3
|
2023-09-08 20:42:06 +00:00
|
|
|
# OPTIMIZED=-O3 #-Ofast
|
|
|
|
|
|
|
|
## Formatter
|
|
|
|
STYLE_BLUEPRINT=webkit
|
|
|
|
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
|
|
|
|
|
|
|
|
## make build
|
|
|
|
build: $(SRC)
|
2023-09-08 22:02:31 +00:00
|
|
|
$(CC) $(OPTIMIZED) $(DEBUG) $(SRC) -o $(OUT)
|
2023-09-08 20:42:06 +00:00
|
|
|
|
|
|
|
format: $(SRC)
|
|
|
|
$(FORMATTER) $(SRC)
|
2023-09-08 21:02:54 +00:00
|
|
|
|
2023-09-09 09:01:04 +00:00
|
|
|
install:
|
|
|
|
cp -n $(OUT) /bin/$(OUT)
|
|
|
|
|
2023-09-08 22:02:31 +00:00
|
|
|
test: $(OUT)
|
|
|
|
/bin/echo -e "123\n45 67" | ./$(OUT)
|
2023-09-10 13:05:28 +00:00
|
|
|
/bin/echo -n "" | ./lc
|
2023-09-08 22:02:31 +00:00
|
|
|
/bin/echo " xx x" | ./$(OUT) -w
|
|
|
|
./$(OUT) $(SRC)
|
|
|
|
./$(OUT) nonexistent_file || true
|