aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2022-10-23 19:41:29 +0200
committerIgor Pashev <pashev.igor@gmail.com>2022-10-23 19:58:11 +0200
commit636bf4dbbc48b68c568085d7723b73d01862cab9 (patch)
tree33970c73eac9114282443610b52475f10ad411be /Makefile
parented749ed4553ac266fa8fdaf7d758f577563fd393 (diff)
downloadmendeleev-636bf4dbbc48b68c568085d7723b73d01862cab9.tar.gz
C: add version using a tree
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 9 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 1bc79ff..9a3f9cd 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ BINARIES := \
mendeleev-f \
mendeleev-hs \
mendeleev-py \
+ mendeleev-tree-c \
SCRIPTS := \
python2:mendeleev.py \
@@ -44,7 +45,8 @@ prof: \
prof-mendeleev-c.txt \
prof-mendeleev-f.txt \
prof-mendeleev-hs.txt \
- prof-mendeleev-py.txt
+ prof-mendeleev-py.txt \
+ prof-mendeleev-tree-c.txt \
%.gmon: %
$(RM) $<-gmon.*
@@ -55,21 +57,21 @@ prof: \
# C
CC = gcc
CFLAGS = -std=c99 -Wall -Wextra -O2
-mendeleev-c: mendeleev.c
+%-c: %.c
$(CC) $(CFLAGS) $< -o $@
CFLAGS_PROF = -O0 -g -pg
-prof-mendeleev-c: mendeleev.c
+prof-%-c: %.c
$(CC) $(CFLAGS_PROF) $< -o $@
-prof-mendeleev-c.txt: prof-mendeleev-c.gmon
- gprof --brief prof-mendeleev-c $< > $@
+prof-%-c.txt: prof-%-c.gmon
+ gprof --brief prof-$*-c $< > $@
# C++
CXX = g++
CXXFLAGS = -std=c++98 -Wall -Wextra -O2
-mendeleev-c-cpp: mendeleev.c
+%-c-cpp: %.c
$(CXX) $(CXXFLAGS) $< -o $@
@@ -101,6 +103,7 @@ prof-mendeleev-hs.txt: prof-mendeleev-hs
./$< +RTS -p -RTS $(PROF_TEST) > /dev/null
$(MV) $<.prof $@
+
# Python
NUITKA = nuitka3
NUITKA_FLAGS = --quiet --remove-output --follow-imports
@@ -113,5 +116,3 @@ prof-mendeleev-py.dat: mendeleev.py
prof-mendeleev-py.txt: prof-mendeleev-py.dat
python3 -c 'import pstats; pstats.Stats("$<").sort_stats("tottime").print_stats()' > $@
-
-