]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/test_and_benchmark/benchmark/build/gcc_gnumake_hosted_liblfds710_liblfds700/Makefile
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / test_and_benchmark / benchmark / build / gcc_gnumake_hosted_liblfds710_liblfds700 / Makefile
1 ##### paths #####
2 BINDIR     := ../../bin
3 OBJDIR     := ../../obj
4 SRCDIR     := ../../src
5 LIBINCDIRS := ../../../../../liblfds7.0.0/liblfds700/inc/ ../../../../liblfds710/inc/ ../../../libbenchmark/inc/ ../../../libshared/inc/
6 LIBBINDIRS := ../../../../../liblfds7.0.0/liblfds700/bin/ ../../../../liblfds710/bin/ ../../../libbenchmark/bin/ ../../../libshared/bin/
7
8 ##### misc #####
9 QUIETLY    := 1>/dev/null 2>/dev/null
10 NULL       := 
11 SPACE      := $(NULL) # TRD : with a trailing space
12
13 ##### sources, objects and libraries #####
14 BINNAME    := benchmark
15 BINARY     := $(BINDIR)/$(BINNAME)
16 SRCDIRS    := .
17 SOURCES    := main.c misc.c util_cmdline.c porting_abstraction_layer_numa_free.c porting_abstraction_layer_numa_malloc.c
18 OBJECTS    := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES)))
19 SYSLIBS    := -lm -lpthread -lrt
20 USRLIBS    := -lbenchmark -lshared -llfds710 -llfds700
21 LIBINCDIRS := $(subst $(SPACE), -I,$(LIBINCDIRS))
22 LIBBINDIRS := $(subst $(SPACE), -L,$(LIBBINDIRS))
23
24 ##### tools #####
25 DG                     := gcc
26 DGFLAGS_MANDATORY      := -MM
27 DGFLAGS_OPTIONAL       := 
28
29 CC                     := gcc
30 CFLAGS_MANDATORY       := -c -pthread -I$(LIBINCDIRS)
31 CFLAGS_OPTIONAL        := -Wall -Werror -Wno-unknown-pragmas
32 CFLAGS_MANDATORY_COV   := -O0 -ggdb -DCOVERAGE -fprofile-arcs -ftest-coverage
33 CFLAGS_MANDATORY_DBG   := -O0 -ggdb -D_DEBUG
34 CFLAGS_MANDATORY_PROF  := -O0 -ggdb -DPROF     -pg
35 CFLAGS_MANDATORY_REL   := -O2       -DNDEBUG
36 CFLAGS_MANDATORY_TSAN  := -O0 -ggdb -DTSAN     -fsanitize=thread -fPIC
37
38 LD                     := gcc
39 LDFLAGS_MANDATORY      := -pthread -L$(LIBBINDIRS)
40 LDFLAGS_OPTIONAL       := -Wall -Werror
41 LDFLAGS_MANDATORY_COV  := -O0 -fprofile-arcs -ftest-coverage
42 LDFLAGS_MANDATORY_DBG  := -O0 -ggdb
43 LDFLAGS_MANDATORY_PROF := -O0 -pg
44 LDFLAGS_MANDATORY_REL  := -O2 -s
45 LDFLAGS_MANDATORY_TSAN := -O0 -fsanitize=thread -pie
46
47 ##### build variants #####
48 ifeq ($(MAKECMDGOALS),) # TRD : default to debug
49   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_DBG)
50   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_DBG)
51 endif
52
53 ifeq ($(findstring cov,$(MAKECMDGOALS)),cov)
54   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_COV)
55   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_COV)
56   SYSLIBS += -lgcov
57 endif
58
59 ifeq ($(findstring dbg,$(MAKECMDGOALS)),dbg)
60   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_DBG)
61   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_DBG)
62 endif
63
64 ifeq ($(findstring prof,$(MAKECMDGOALS)),prof)
65   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_PROF)
66   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_PROF)
67 endif
68
69 ifeq ($(findstring rel,$(MAKECMDGOALS)),rel)
70   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_REL)
71   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_REL)
72 endif
73
74 ifeq ($(findstring tsan,$(MAKECMDGOALS)),tsan)
75   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_TSAN)
76   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_TSAN)
77 endif
78
79 ##### search paths #####
80 vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS))
81
82 ##### implicit rules #####
83 $(OBJDIR)/%.o : %.c
84         $(DG) $(DGFLAGS_OPTIONAL) $(DGFLAGS) $(DGFLAGS_MANDATORY) $< >$(OBJDIR)/$*.d
85         $(CC) $(CFLAGS_OPTIONAL) $(CFLAGS) $(CFLAGS_MANDATORY) -o $@ $<
86
87 ##### explicit rules #####
88 $(BINARY) : $(OBJECTS)
89         $(LD) -o $(BINARY) $(LDFLAGS_OPTIONAL) $(LDFLAGS) $(LDFLAGS_MANDATORY) $(OBJECTS) $(USRLIBS) $(SYSLIBS)
90         chmod +x $(BINARY)
91
92 ##### phony #####
93 .PHONY : clean cov dbg prof rel tsan vanilla
94
95 clean : 
96         @rm -f $(BINDIR)/$(BINNAME) $(OBJDIR)/*.o $(OBJDIR)/*.d $(OBJDIR)/*.gcda $(OBJDIR)/*.gcno
97
98 cov     : $(BINARY)
99 dbg     : $(BINARY)
100 prof    : $(BINARY)
101 rel     : $(BINARY)
102 tsan    : $(BINARY)
103 vanilla : $(BINARY)
104
105 ##### dependencies #####
106 -include $(DEPENDS)
107