Skip to content

Commit df0f852

Browse files
authored
Fix tests/Makefile (#62)
- Use CXX/CXXFLAGS as this is c++ code and CFLAGS/CPPFLAGS are unrelated - Allow flags to be provided by the environment - Use pkg-config for gtest discovery instead of using nonportable hardcoded flags - Name target after the file it produces
1 parent 3b93363 commit df0f852

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
CC=g++
2-
CFLAGS=-Wall -std=c++11
3-
CPPFLAGS=-Wall -std=c++11
4-
LDFLAGS=-lpthread -lgtest -lgtest_main -lpthread -L/usr/lib -L/usr/lib/x86_64-linux-gnu
1+
CXX?=g++
2+
CXXFLAGS+=-Wall -std=c++11 `pkg-config --cflags gtest_main`
3+
LDFLAGS+=`pkg-config --libs gtest_main`
54

65
OBJS=ts-roundtrip.o ts-snippets.o ts-utf8.o ts-bugfix.o ts-quotes.o ts-noconvert.o
76

87
BIN=./tests
98

10-
all: $(OBJS)
11-
$(CC) -o $(BIN) $(OBJS) $(LDFLAGS)
9+
all: $(BIN)
10+
11+
$(BIN): $(OBJS)
12+
$(CXX) -o $(BIN) $(OBJS) $(LDFLAGS)
1213

1314
clean:
1415
rm -f core $(OBJS) $(BIN)

0 commit comments

Comments
 (0)