Skip to content

Commit 6311b12

Browse files
committed
Allow testing this with many compilers using make CXX=c++compiler.
1 parent 1f0dab2 commit 6311b12

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*.o
22
*flops
3+
*.dSYM/
4+
*flops-*

Makefile

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
CPPFLAGS += -fopenmp -O3 -g -march=native
22

3-
all: sseflops avxflops
3+
ifneq ($(CXX),c++)
4+
ifneq ($(CXX),g++)
5+
SUFFIX := -$(CXX)
6+
endif
7+
endif
48

5-
sseflops: sseflops.o
6-
$(CXX) -o $@ $< $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
9+
TESTS := sseflops$(SUFFIX) avxflops$(SUFFIX)
710

8-
avxflops: avxflops.o
9-
$(CXX) -o $@ $< $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
11+
all: $(TESTS)
12+
13+
clean:; rm -f $(TESTS) $(addsuffix .o, $(TESTS))
1014

11-
clean:
12-
rm -f *.o
15+
.SECONDARY:
16+
17+
%$(SUFFIX).o:: %.cc
18+
$(CXX) -o $@ -c $< $(CXXFLAGS) $(CPPFLAGS)
19+
20+
%$(SUFFIX): %$(SUFFIX).o
21+
$(CXX) -o $@ $< $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ Usage
77
-----
88

99
Just `make` then run. If you do not have min. *Sandy Bridge / AVX* CPU `avxflops` build will fail, but you can still test with `sseflops`.
10+
11+
Use `make CXX=c++compiler` to build test with other compiler, the output files will be suffixed with `-c++compiler`.

0 commit comments

Comments
 (0)