From 636bf4dbbc48b68c568085d7723b73d01862cab9 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sun, 23 Oct 2022 19:41:29 +0200 Subject: C: add version using a tree --- Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Makefile') 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()' > $@ - - -- cgit v1.2.3