Skip to content

Commit d1523cf

Browse files
author
Raghuveer Devulapalli
committed
Update Makefile to just build using meson
1 parent fb09010 commit d1523cf

File tree

1 file changed

+0
-78
lines changed

1 file changed

+0
-78
lines changed

Makefile

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,10 @@
1-
# When unset, discover g++. Prioritise the latest version on the path.
2-
ifeq (, $(and $(strip $(CXX)), $(filter-out default undefined, $(origin CXX))))
3-
override CXX := $(shell which g++-13 g++-12 g++-11 g++-10 g++-9 g++-8 g++ 2>/dev/null | head -n 1)
4-
ifeq (, $(strip $(CXX)))
5-
$(error Could not locate the g++ compiler. Please manually specify its path using the CXX variable)
6-
endif
7-
endif
8-
9-
export CXX
10-
CXXFLAGS += $(OPTIMFLAG) $(MARCHFLAG)
11-
override CXXFLAGS += -I$(SRCDIR) -I$(UTILSDIR)
12-
GTESTCFLAGS := `pkg-config --cflags gtest_main`
13-
GTESTLDFLAGS := `pkg-config --static --libs gtest_main`
14-
GBENCHCFLAGS := `pkg-config --cflags benchmark`
15-
GBENCHLDFLAGS := `pkg-config --static --libs benchmark`
16-
OPTIMFLAG := -O3
17-
MARCHFLAG := -march=sapphirerapids
18-
19-
SRCDIR := ./src
20-
TESTDIR := ./tests
21-
BENCHDIR := ./benchmarks
22-
UTILSDIR := ./utils
23-
24-
SRCS := $(wildcard $(addprefix $(SRCDIR)/, *.hpp *.h))
25-
UTILSRCS := $(wildcard $(addprefix $(UTILSDIR)/, *.hpp *.h))
26-
TESTSRCS := $(wildcard $(addprefix $(TESTDIR)/, *.hpp *.h))
27-
BENCHSRCS := $(wildcard $(addprefix $(BENCHDIR)/, *.hpp *.h))
28-
UTILS := $(wildcard $(UTILSDIR)/*.cpp)
29-
TESTS := $(wildcard $(TESTDIR)/*.cpp)
30-
BENCHS := $(wildcard $(BENCHDIR)/*.cpp)
31-
32-
test_cxx_flag = $(shell 2>/dev/null $(CXX) -o /dev/null $(1) -c -x c++ /dev/null; echo $$?)
33-
34-
# Compiling AVX512-FP16 instructions wasn't possible until GCC 12
35-
ifeq ($(call test_cxx_flag,-mavx512fp16), 1)
36-
BENCHS_SKIP += bench-qsortfp16.cpp
37-
TESTS_SKIP += test-qsortfp16.cpp
38-
endif
39-
40-
# Sapphire Rapids was otherwise supported from GCC 11. Downgrade if required.
41-
ifeq ($(call test_cxx_flag,$(MARCHFLAG)), 1)
42-
MARCHFLAG := -march=icelake-client
43-
endif
44-
45-
BENCHOBJS := $(patsubst %.cpp, %.o, $(filter-out $(addprefix $(BENCHDIR)/, $(BENCHS_SKIP)), $(BENCHS)))
46-
TESTOBJS := $(patsubst %.cpp, %.o, $(filter-out $(addprefix $(TESTDIR)/, $(TESTS_SKIP)), $(TESTS)))
47-
UTILOBJS := $(UTILS:.cpp=.o)
48-
49-
# Stops make from wondering if it needs to generate the .hpp files (.cpp and .h have equivalent rules by default)
50-
%.hpp:
51-
52-
.PHONY: all
53-
.DEFAULT_GOAL := all
54-
all: test bench
55-
56-
.PHONY: test
57-
test: testexe
58-
59-
.PHONY: bench
60-
bench: benchexe
61-
62-
$(UTILOBJS): $(UTILSRCS)
63-
64-
$(TESTOBJS): $(TESTSRCS) $(UTILSRCS) $(SRCS)
65-
$(TESTDIR)/%.o: override CXXFLAGS += $(GTESTCFLAGS)
66-
67-
testexe: $(TESTOBJS) $(UTILOBJS)
68-
$(CXX) $(CXXFLAGS) $^ $(LDLIBS) $(LDFLAGS) -lgtest_main $(GTESTLDFLAGS) -o $@
69-
70-
$(BENCHOBJS): $(BENCHSRCS) $(UTILSRCS) $(SRCS)
71-
$(BENCHDIR)/%.o: override CXXFLAGS += $(GBENCHCFLAGS)
72-
73-
benchexe: $(BENCHOBJS) $(UTILOBJS)
74-
$(CXX) $(CXXFLAGS) $^ $(LDLIBS) $(LDFLAGS) -lbenchmark_main $(GBENCHLDFLAGS) -o $@
75-
76-
.PHONY: meson
771
meson:
782
meson setup --warnlevel 2 --werror --buildtype release builddir
793
cd builddir && ninja
804

81-
.PHONY: mesondebug
825
mesondebug:
836
meson setup --warnlevel 2 --werror --buildtype debug debug
847
cd debug && ninja
858

86-
.PHONY: clean
879
clean:
8810
$(RM) -rf $(TESTOBJS) $(BENCHOBJS) $(UTILOBJS) testexe benchexe builddir

0 commit comments

Comments
 (0)