Skip to content

Commit c209efe

Browse files
author
falkTX
committed
Makefile tweaks
1 parent a36bf9e commit c209efe

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11

2-
CC ?= gcc
2+
CC ?= gcc
3+
CXX ?= g++
4+
5+
CFLAGS += $(shell pkg-config --cflags jack)
6+
LDFLAGS += $(shell pkg-config --libs jack)
37

48
TESTS=test_new test_cond_wait test_cond_wait_simple test_printf
59

610
all: jack_interposer.so
711

812
jack_interposer.so: jack_interposer.c checkers.c manual.c
9-
$(CC) $< $(CFLAGS) -Wall -fPIC $(LDFLAGS) -Wl,--no-undefined -shared -pthread -ldl -ljack -o jack_interposer.so
13+
$(CC) $< -o $@ $(CFLAGS) -Wall -fPIC $(LDFLAGS) -Wl,--no-undefined -shared -pthread -ldl
1014

1115
checkers.c: functions checker_fragment.c
1216
./generate_checkers.pl < functions
@@ -21,13 +25,13 @@ test: $(TESTS) jack_interposer.so
2125
LD_PRELOAD=./jack_interposer.so ./test_printf
2226

2327
test_new: test_new.cpp
24-
g++ -o test_new test_new.cpp -ljack
28+
$(CXX) $< -o $@ $(CFLAGS) $(LDFLAGS)
2529

2630
test_cond_wait_simple: test_cond_wait_simple.c
27-
gcc -o test_cond_wait_simple test_cond_wait_simple.c -pthread -ldl
31+
$(CC) $< -o $@ $(CFLAGS) $(LDFLAGS) -pthread -ldl
2832

2933
test_cond_wait: test_cond_wait.c
30-
gcc -o test_cond_wait test_cond_wait.c -ljack -lpthread
34+
$(CC) $< -o $@ $(CFLAGS) $(LDFLAGS) -pthread
3135

3236
test_printf: test_printf.c
33-
gcc -o test_printf test_printf.c -ljack
37+
$(CC) $< -o $@ $(CFLAGS) $(LDFLAGS)

0 commit comments

Comments
 (0)