makefile tweak

This commit is contained in:
NunoSempere 2023-11-19 00:04:10 +00:00
parent d3af874403
commit a543bd5b94
2 changed files with 12 additions and 7 deletions

Binary file not shown.

View File

@ -5,22 +5,26 @@
# make run # make run
# Compiler # Compiler
CC=gcc CC=gcc # required for nested functions
# CC=tcc # <= faster compilation # CC=tcc # <= faster compilation
# Main file # Main file
SRC=example.c ../../squiggle.c ../../squiggle_more.c SRC=example.c ../../squiggle.c ../../squiggle_more.c
OUTPUT=example OUTPUT=./example
## Dependencies ## Dependencies
OPENMP=-fopenmp
MATH=-lm MATH=-lm
DEPENDENCIES=$(MATH) $(OPENMP)
# OPENMP=-fopenmp
## Flags ## Flags
DEBUG= #'-g' DEBUG= #'-g'
STANDARD=-std=c99 STANDARD=-std=c99 ## gnu99 allows for nested functions.
EXTENSIONS= #-fnested-functions
WARNINGS=-Wall WARNINGS=-Wall
OPTIMIZED=-O3#-Ofast OPTIMIZED=-O3#-Ofast
# OPENMP=-fopenmp CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED)
## Formatter ## Formatter
STYLE_BLUEPRINT=webkit STYLE_BLUEPRINT=webkit
@ -28,13 +32,14 @@ FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
## make build ## make build
build: $(SRC) build: $(SRC)
$(CC) $(OPTIMIZED) $(DEBUG) $(SRC) $(MATH) -o $(OUTPUT) # gcc -std=gnu99 example.c -lm -o example
$(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT)
format: $(SRC) format: $(SRC)
$(FORMATTER) $(SRC) $(FORMATTER) $(SRC)
run: $(SRC) $(OUTPUT) run: $(SRC) $(OUTPUT)
OMP_NUM_THREADS=1 ./$(OUTPUT) && echo ./$(OUTPUT) && echo
time-linux: time-linux:
@echo "Requires /bin/time, found on GNU/Linux systems" && echo @echo "Requires /bin/time, found on GNU/Linux systems" && echo