Skip to content

Commit

Permalink
Add building profile in Makefile for C code.
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanSkocic committed Nov 21, 2024
1 parent c1948b9 commit 76c3dc9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions C/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
ifeq ($(profile), debug)
CFLAGS = $(CFLAGS_DEBUG)
else
CFLAGS=$(CFLAGS_RELEASE)
endif

PY=python
GEN_C=../scripts/gen_c.py
GEN_H=../scripts/gen_headers.py
Expand Down Expand Up @@ -37,10 +43,10 @@ include/%.h: ../data/%.toml
build: sources $(C_OBJ)

example: ./example/example.c build static shared
gcc $< -I./include -L./build/ -lcodata $(CFLAGS_RELEASE) $(FPM_CFLAGS) -o ./build/$@ -Wl,-rpath=.
gcc $< -I./include -L./build/ -lcodata $(CFLAGS) $(FPM_CFLAGS) -o ./build/$@ -Wl,-rpath=.

build/%.o: src/%.c
gcc -c -I./include -fPIC $(CFLAGS_RELEASE) $(FPM_CFLAGS) $< -o $@
gcc -c -I./include -fPIC $(CFLAGS) $(FPM_CFLAGS) $< -o $@
# ---------------------------------------------------------------------


Expand Down

0 comments on commit 76c3dc9

Please sign in to comment.