]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/test_and_benchmark/libtest/build/gcc_gnumake_hosted/Makefile
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / test_and_benchmark / libtest / build / gcc_gnumake_hosted / Makefile
1 ##### paths #####
2 BINDIR := ../../bin
3 INCDIR := ../../inc
4 OBJDIR := ../../obj
5 SRCDIR := ../../src
6
7 ##### misc #####
8 QUIETLY        := 1>/dev/null 2>/dev/null
9 VERSION_NUMBER := 1
10 MINOR_NUMBER   := 0
11 RELEASE_NUMBER := 0
12
13 ##### sources, objects and libraries #####
14 BINNAME    := libtest
15 ARFILENAME := $(BINNAME).a
16 ARPATHNAME := $(BINDIR)/$(ARFILENAME)
17 SOBASENAME := $(BINNAME).so
18 SONAME     := $(SOBASENAME).$(VERSION_NUMBER)
19 SOFILENAME := $(SONAME).$(MINOR_NUMBER).$(RELEASE_NUMBER)
20 SOPATHNAME := $(BINDIR)/$(SOFILENAME)
21 INCNAME    := $(INCDIR)/$(BINNAME).h
22 SRCDIRS    := libtest_misc libtest_porting_abstraction_layer libtest_results libtest_test libtest_tests libtest_testsuite libtest_threadset
23 SOURCES    := libtest_misc_determine_erg.c libtest_misc_globals.c libtest_misc_memory_helpers.c libtest_misc_pal_helpers.c libtest_misc_query.c \
24               libtest_porting_abstraction_layer_free.c libtest_porting_abstraction_layer_get_full_logical_processor_set.c libtest_porting_abstraction_layer_malloc.c \
25               libtest_results_cleanup.c libtest_results_get_result.c libtest_results_init.c libtest_results_put_result.c \
26               libtest_test_cleanup.c libtest_test_init.c libtest_test_run.c \
27               libtest_tests_btree_addonly_unbalanced_alignment.c libtest_tests_btree_addonly_unbalanced_random_adds_fail.c libtest_tests_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c libtest_tests_btree_addonly_unbalanced_random_adds_overwrite.c \
28               libtest_tests_freelist_alignment.c libtest_tests_freelist_ea_popping.c libtest_tests_freelist_ea_popping_and_pushing.c libtest_tests_freelist_ea_pushing.c libtest_tests_freelist_ea_rapid_popping_and_pushing.c libtest_tests_freelist_without_ea_popping.c libtest_tests_freelist_without_ea_popping_and_pushing.c libtest_tests_freelist_without_ea_pushing.c libtest_tests_freelist_without_ea_rapid_popping_and_pushing.c \
29               libtest_tests_hash_addonly_alignment.c libtest_tests_hash_addonly_iterate.c libtest_tests_hash_addonly_random_adds_fail.c libtest_tests_hash_addonly_fail_and_overwrite.c libtest_tests_hash_addonly_random_adds_overwrite.c \
30               libtest_tests_list_addonly_singlylinked_ordered_alignment.c libtest_tests_list_addonly_singlylinked_ordered_new_ordered.c libtest_tests_list_addonly_singlylinked_ordered_new_ordered_with_cursor.c \
31               libtest_tests_list_addonly_singlylinked_unordered_alignment.c libtest_tests_list_addonly_singlylinked_unordered_new_after.c libtest_tests_list_addonly_singlylinked_unordered_new_end.c libtest_tests_list_addonly_singlylinked_unordered_new_start.c \
32               libtest_tests_porting_abstraction_layer_atomic_add.c libtest_tests_porting_abstraction_layer_atomic_cas.c libtest_tests_porting_abstraction_layer_atomic_dwcas.c libtest_tests_porting_abstraction_layer_atomic_exchange.c \
33               libtest_tests_prng_alignment.c libtest_tests_prng_generate.c \
34               libtest_tests_queue_bounded_manyproducer_manyconsumer_alignment.c libtest_tests_queue_bounded_manyproducer_manyconsumer_count.c libtest_tests_queue_bounded_manyproducer_manyconsumer_enqueuing.c libtest_tests_queue_bounded_manyproducer_manyconsumer_dequeuing.c libtest_tests_queue_bounded_manyproducer_manyconsumer_enqueuing_and_dequeuing.c libtest_tests_queue_bounded_manyproducer_manyconsumer_rapid_enqueuing_and_dequeuing.c \
35               libtest_tests_queue_bounded_singleproducer_singleconsumer_dequeuing.c libtest_tests_queue_bounded_singleproducer_singleconsumer_enqueuing.c libtest_tests_queue_bounded_singleproducer_singleconsumer_enqueuing_and_dequeuing.c \
36               libtest_tests_queue_unbounded_manyproducer_manyconsumer_alignment.c libtest_tests_queue_unbounded_manyproducer_manyconsumer_dequeuing.c libtest_tests_queue_unbounded_manyproducer_manyconsumer_enqueuing.c libtest_tests_queue_unbounded_manyproducer_manyconsumer_enqueuing_and_dequeuing.c libtest_tests_queue_unbounded_manyproducer_manyconsumer_enqueuing_with_malloc_and_dequeuing_with_free.c libtest_tests_queue_unbounded_manyproducer_manyconsumer_rapid_enqueuing_and_dequeuing.c \
37               libtest_tests_ringbuffer_reading.c libtest_tests_ringbuffer_reading_and_writing.c libtest_tests_ringbuffer_writing.c \
38               libtest_tests_stack_alignment.c libtest_tests_stack_popping.c libtest_tests_stack_popping_and_pushing.c libtest_tests_stack_pushing.c libtest_tests_stack_rapid_popping_and_pushing.c \
39               libtest_testsuite_cleanup.c libtest_testsuite_init.c libtest_testsuite_run.c \
40               libtest_threadset_add.c libtest_threadset_cleanup.c libtest_threadset_init.c libtest_threadset_operations.c
41 OBJECTS    := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES)))
42 SYSLIBS    := 
43
44 ##### tools #####
45 DG                     := gcc
46 DGFLAGS_MANDATORY      := -MM
47 DGFLAGS_OPTIONAL       := -std=gnu89
48
49 CC                     := gcc
50 CFLAGS_MANDATORY       := -c -fno-strict-aliasing
51 CFLAGS_OPTIONAL        := -std=gnu89 -Wall -Werror -Wno-unknown-pragmas -Wno-uninitialized -Wno-unused-but-set-variable
52 CFLAGS_MANDATORY_COV   := -O0 -ggdb -DCOVERAGE -fprofile-arcs -ftest-coverage
53 CFLAGS_MANDATORY_DBG   := -O0 -ggdb -D_DEBUG
54 CFLAGS_MANDATORY_PROF  := -O0 -ggdb -DPROF     -pg
55 CFLAGS_MANDATORY_REL   := -O2       -DNDEBUG
56 CFLAGS_MANDATORY_TSAN  := -O0 -ggdb -DTSAN     -fsanitize=thread -fPIC
57
58 AR                     := ar
59 ARFLAGS                :=
60 ARFLAGS_MANDATORY      := rcs
61 ARFLAGS_OPTIONAL       :=
62
63 LD                     := gcc
64 LDFLAGS_MANDATORY      := -shared -Wl,-soname,$(SONAME) -o $(SOPATHNAME)
65 LDFLAGS_OPTIONAL       := -std=gnu89 -Wall -Werror
66 LDFLAGS_MANDATORY_COV  := -O0 -fprofile-arcs -ftest-coverage
67 LDFLAGS_MANDATORY_DBG  := -O0 -ggdb
68 LDFLAGS_MANDATORY_PROF := -O0 -pg
69 LDFLAGS_MANDATORY_REL  := -O2 -s
70 LDFLAGS_MANDATORY_TSAN := -O0 -fsanitize=thread -fPIC
71
72 ##### build variants #####
73 ifeq ($(findstring so,$(MAKECMDGOALS)),so)
74   CFLAGS_MANDATORY += -fPIC
75 endif
76
77 # TRD : default to debug
78 ifeq ($(MAKECMDGOALS),)
79   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_DBG)
80   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_DBG)
81 endif
82
83 ifeq ($(findstring cov,$(MAKECMDGOALS)),cov)
84   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_COV)
85   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_COV)
86   SYSLIBS += -lgcov
87 endif
88
89 ifeq ($(findstring dbg,$(MAKECMDGOALS)),dbg)
90   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_DBG)
91   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_DBG)
92 endif
93
94 ifeq ($(findstring prof,$(MAKECMDGOALS)),prof)
95   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_PROF)
96   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_PROF)
97 endif
98
99 ifeq ($(findstring rel,$(MAKECMDGOALS)),rel)
100   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_REL)
101   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_REL)
102 endif
103
104 ifeq ($(findstring tsan,$(MAKECMDGOALS)),tsan)
105   CFLAGS_MANDATORY  += $(CFLAGS_MANDATORY_TSAN)
106   LDFLAGS_MANDATORY += $(LDFLAGS_MANDATORY_TSAN)
107 endif
108
109 ##### search paths #####
110 vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS))
111
112 ##### implicit rules #####
113 $(OBJDIR)/%.o : %.c
114         $(DG) $(DGFLAGS_OPTIONAL) $(DGFLAGS) $(DGFLAGS_MANDATORY) $< >$(OBJDIR)/$*.d
115         $(CC) $(CFLAGS_OPTIONAL) $(CFLAGS) $(CFLAGS_MANDATORY) -o $@ $<
116
117 ##### explicit rules #####
118 $(ARPATHNAME) : $(OBJECTS)
119         $(AR) $(ARFLAGS_OPTIONAL) $(ARFLAGS) $(ARFLAGS_MANDATORY) $(ARPATHNAME) $(OBJECTS)
120
121 $(SOPATHNAME) : $(OBJECTS)
122         $(LD) $(LDFLAGS_OPTIONAL) $(LDFLAGS) $(LDFLAGS_MANDATORY) $(OBJECTS) -o $(SOPATHNAME)
123         @ln -fs $(SOFILENAME) $(BINDIR)/$(SONAME)
124         @ln -fs $(SOFILENAME) $(BINDIR)/$(SOBASENAME)
125
126 ##### phony #####
127 .PHONY : clean ar_cov ar_dbg ar_prof ar_rel ar_tsan ar_vanilla so_cov so_dbg so_prof so_rel so_tsan so_vanilla
128
129 clean : 
130         @rm -f $(BINDIR)/* $(OBJDIR)/*
131
132 ar_cov       : $(ARPATHNAME) # archive (.a), coverage
133 ar_dbg       : $(ARPATHNAME) # archive (.a), debug
134 ar_prof      : $(ARPATHNAME) # archive (.a), profiling
135 ar_rel       : $(ARPATHNAME) # archive (.a), release
136 ar_tsan      : $(ARPATHNAME) # archive (.a), thread sanitizer
137 ar_vanilla   : $(ARPATHNAME) # archive (.a), no specific-build arguments
138 ar_install   :
139   # TRD : leading backslash to use command rather than alias
140   #       as many Linux distros have a built-in alias to force
141   #       a prompt ("y/n?") on file overwrite - silent and
142   #       unexpected interference which breaks a makefile
143         @mkdir -p $(INSLIBDIR)
144         @\cp $(ARPATHNAME) $(INSLIBDIR)
145         @mkdir -p $(INSINCDIR)
146         @\cp -r $(INCDIR)/* $(INSINCDIR)
147 ar_uninstall :
148         @rm    $(INSLIBDIR)/$(ARFILENAME)
149         @rm -r $(INSINCDIR)/$(BINNAME)
150         @rm -r $(INSINCDIR)/$(BINNAME).h
151
152 so_cov       : $(SOPATHNAME) # shared (.so), coverage
153 so_dbg       : $(SOPATHNAME) # shared (.so), debug
154 so_prof      : $(SOPATHNAME) # shared (.so), profiling
155 so_rel       : $(SOPATHNAME) # shared (.so), release
156 so_tsan      : $(SOPATHNAME) # shared (.so), thread sanitizer
157 so_vanilla   : $(SOPATHNAME) # shared (.so), no specific-build arguments
158 so_install   : 
159         @mkdir -p $(INSINCDIR)
160         @\cp $(SOPATHNAME) $(INSLIBDIR)
161         @ldconfig -vn $(INSLIBDIR)
162         @ln -s $(SONAME) $(INSLIBDIR)/$(SOBASENAME)
163         @mkdir -p $(INSLIBDIR)
164         @\cp -r $(INCDIR)/* $(INSINCDIR)
165 so_uninstall : 
166         @rm -f $(INSLIBDIR)/$(SOFILENAME)
167         @rm -f $(INSLIBDIR)/$(SOBASENAME)
168         @rm -f $(INSLIBDIR)/$(SONAME)
169         @rm -r $(INSINCDIR)/$(BINNAME)
170         @rm -r $(INSINCDIR)/$(BINNAME).h
171
172 ##### dependencies #####
173 -include $(DEPENDS)
174