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