File: Makefile.in

package info (click to toggle)
flint 2.5.2-19
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 30,308 kB
  • sloc: ansic: 289,367; cpp: 11,210; python: 1,280; sh: 649; makefile: 283
file content (251 lines) | stat: -rw-r--r-- 13,593 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
ifdef $(DLPATH)
  $(DLPATH):=$($(DLPATH)):$(DLPATH_ADD)
else
  $(DLPATH):=$(DLPATH_ADD)
endif

LIBDIR=lib

QUIET_CC  = @echo '   ' CC  ' ' $@;
QUIET_CXX = @echo '   ' CXX ' ' $@;
QUIET_AR  = @echo '   ' AR  ' ' $@;

AT=@

BUILD_DIRS = ulong_extras long_extras perm fmpz fmpz_vec fmpz_poly \
   fmpq_poly fmpz_mat fmpz_lll mpfr_vec mpfr_mat mpf_vec mpf_mat nmod_vec nmod_poly \
   nmod_poly_factor arith mpn_extras nmod_mat fmpq fmpq_vec fmpq_mat padic \
   fmpz_poly_q fmpz_poly_mat nmod_poly_mat fmpz_mod_poly \
   fmpz_mod_poly_factor fmpz_factor fmpz_poly_factor fft qsieve \
   double_extras d_vec d_mat padic_poly padic_mat qadic  \
   fq fq_vec fq_mat fq_poly fq_poly_factor\
   fq_nmod fq_nmod_vec fq_nmod_mat fq_nmod_poly fq_nmod_poly_factor \
   fq_zech fq_zech_vec fq_zech_mat fq_zech_poly fq_zech_poly_factor \
   $(EXTRA_BUILD_DIRS)

TEMPLATE_DIRS = fq_vec_templates fq_mat_templates fq_poly_templates \
   fq_poly_factor_templates fq_templates

export

SOURCES = printf.c fprintf.c sprintf.c scanf.c fscanf.c sscanf.c clz_tab.c memory_manager.c version.c profiler.c thread_support.c
LIB_SOURCES = $(wildcard $(patsubst %, %/*.c, $(BUILD_DIRS)))  $(patsubst %, %/*.c, $(TEMPLATE_DIRS))

HEADERS = $(patsubst %, %.h, $(BUILD_DIRS)) NTL-interface.h flint.h longlong.h config.h gmpcompat.h fft_tuning.h fmpz-conversions.h profiler.h templates.h $(patsubst %, %.h, $(TEMPLATE_DIRS))

OBJS = $(patsubst %.c, build/%.o, $(SOURCES))
LIB_OBJS = $(patsubst %, build/%/*.o, $(BUILD_DIRS))

LOBJS = $(patsubst %.c, build/%.lo, $(SOURCES))
LIB_LOBJS = $(patsubst %, build/%/*.lo, $(BUILD_DIRS))
MOD_LOBJS = $(patsubst %, build/%.lo, $(BUILD_DIRS))

EXMP_SOURCES = $(wildcard examples/*.c)
EXMPS = $(patsubst %.c, %, $(EXMP_SOURCES))

TEST_SOURCES = $(wildcard test/*.c)
TESTS = $(patsubst %.c, build/%$(EXEEXT), $(TEST_SOURCES))

PROF_SOURCES = $(wildcard profile/*.c)
PROFS = $(patsubst %.c, %$(EXEEXT), $(PROF_SOURCES))

TUNE_SOURCES = $(wildcard tune/*.c)
TUNE = $(patsubst %.c, %$(EXEEXT), $(TUNE_SOURCES))

EXT_SOURCES = $(foreach ext, $(EXTENSIONS), $(foreach dir, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), $(wildcard $(ext)/$(dir)/*.c)))
EXT_TEST_SOURCES = $(foreach ext, $(EXTENSIONS), $(foreach dir, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), $(wildcard $(ext)/$(dir)/test/t-*.c)))
EXT_TUNE_SOURCES = $(foreach ext, $(EXTENSIONS), $(foreach dir, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), $(wildcard $(ext)/$(dir)/tune/*.c)))
EXT_PROF_SOURCES = $(foreach ext, $(EXTENSIONS), $(foreach dir, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), $(wildcard $(ext)/$(dir)/profile/p-*.c)))
EXT_OBJS = $(foreach ext, $(EXTENSIONS), $(foreach dir, $(filter-out %templates, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h))), build/$(dir).lo))
EXT_HEADERS = $(foreach ext, $(EXTENSIONS), $(wildcard $(ext)/*.h))
EXT_EXMP_SOURCES = $(foreach ext, $(EXTENSIONS), $(wildcard $(ext)/examples/*.c))

all: library

quiet: library

verbose:
	$(MAKE) AT= QUIET_CC= QUIET_CXX= QUIET_AR=

clean:
	$(AT)$(foreach dir, $(BUILD_DIRS), BUILD_DIR=../build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) clean || exit $$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach dir, $(filter-out %templates, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h))), BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) clean || exit $$?;))
	rm -rf test_helpers.o profiler.o
	rm -f $(OBJS) $(LOBJS) $(TESTS) $(PROFS) $(EXMPS)
	rm -f libflint.a
	rm -f $(wildcard $(FLINT_LIBNAME)*)
	rm -rf build

distclean: clean
	rm -f config.h fft_tuning.h fmpz-conversions.h Makefile fmpz/fmpz.c

dist:
	git archive --format tar --prefix flint-2.5.2/ flint-2.5 > ../flint-2.5.2.tar; gzip ../flint-2.5.2.tar
	git archive --format zip --prefix flint-2.5.2/ flint-2.5 > ../flint-2.5.2.zip 

profile: library $(PROF_SOURCES) $(EXT_PROF_SOURCES) build/profiler.o
	mkdir -p build/profile
ifndef MOD
	$(AT)$(foreach prog, $(PROFS), $(CC) $(CFLAGS) -std=gnu99 $(INCS) $(prog).c build/profiler.o -o build/$(prog) $(LIBS) || exit $$?;)
	$(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir)/profile; BUILD_DIR=../build/$(dir); export BUILD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) profile || exit $$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach dir, $(filter-out %templates, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h))), mkdir -p build/$(dir)/profile; BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) profile || exit $$?;))
else
	$(AT)$(foreach dir, $(MOD), mkdir -p build/$(dir)/profile; BUILD_DIR=../build/$(dir); export BUILD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) profile || exit $$?;)
endif

tune: library $(TUNE_SOURCES) $(EXT_TUNE_SOURCES)
	mkdir -p build/tune
	$(AT)$(foreach prog, $(TUNE), $(CC) $(CFLAGS) $(INCS) $(prog).c -o build/$(prog) $(LIBS) || exit $$?;)
	$(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir)/tune; BUILD_DIR=../build/$(dir); export BUILD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) tune || exit $$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach dir, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), mkdir -p build/$(dir)/tune; BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) tune || exit $$?;))

examples: library $(EXMP_SOURCES) $(EXT_EXMP_SOURCES) $(EXT_HEADERS)
	mkdir -p build/examples
	$(AT)$(foreach prog, $(EXMPS), $(CC) $(CFLAGS) $(INCS) $(prog).c -o build/$(prog) $(LIBS) || exit $$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach prog, $(patsubst $(ext)/examples/%.c, %, $(wildcard $(ext)/examples/*.c)), $(CC) $(CFLAGS) $(INCS) $(ext)/examples/$(prog).c -o build/examples/$(prog) $(LIBS) || exit $$?;))

$(FLINT_LIB): $(LOBJS) $(LIB_SOURCES) $(EXT_SOURCES) $(HEADERS) $(EXT_HEADERS) | build build/interfaces
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach dir, $(filter-out %templates, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h))), mkdir -p build/$(dir); BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) shared || exit $$?;))
	$(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir); BUILD_DIR=../build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) shared || exit $$?;)
	$(AT)if [ "$(WANT_NTL)" -eq "1" ]; then \
	  $(MAKE) build/interfaces/NTL-interface.lo; \
	  $(CXX) $(CXXFLAGS) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) build/interfaces/NTL-interface.lo $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) -o $(FLINT_LIB) $(LDFLAGS) $(LIBS2); \
	fi
	$(AT)if [ "$(WANT_NTL)" -ne "1" ]; then \
	  $(CC) $(CFLAGS) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) -o $(FLINT_LIB) $(LDFLAGS) $(LIBS2); \
	fi
	-$(AT)if [ "$(FLINT_SOLIB)" -eq "1" ]; then \
		$(LDCONFIG) -n "$(CURDIR)"; \
	fi
	ln -sf "$(FLINT_LIB)" "$(FLINT_LIBNAME)"; \

libflint.a: $(OBJS) $(LIB_SOURCES) $(EXT_SOURCES) $(HEADERS) $(EXT_HEADERS) | build build/interfaces
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach dir, $(filter-out %templates, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h))), mkdir -p build/$(dir); BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) static || exit $$?;))
	$(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir); BUILD_DIR=../build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) static || exit $$?;)
	$(AT)if [ "$(FLINT_SHARED)" -eq "0" ]; then \
		touch test/t-*.c; \
		$(foreach dir, $(BUILD_DIRS), touch $(dir)/test/t-*.c;) \
		$(foreach ext, $(EXTENSIONS), $(foreach mod, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), touch $(ext)/$(mod)/test/t-*.c;)) \
	fi
	$(AT)if [ "$(WANT_NTL)" -eq "1" ]; then \
		$(MAKE) build/interfaces/NTL-interface.o; \
		$(AR) rcs libflint.a build/interfaces/NTL-interface.o; \
	fi
	$(QUIET_AR) $(AR) rcs libflint.a $(OBJS);
	$(AT)$(foreach mod, $(BUILD_DIRS), $(AR) rcs libflint.a build/$(mod)/*.o || exit $$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach mod, $(filter-out %templates, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h))), $(AR) rcs libflint.a build/$(mod)/*.o || exit $$?;))

library: build/CPimport.h
	$(AT)if [ "$(FLINT_SHARED)" -eq "1" ]; then \
		$(MAKE) shared; \
	fi
	$(AT)if [ "$(FLINT_STATIC)" -eq "1" ]; then \
		$(MAKE) static; \
	fi

shared: $(FLINT_LIB)

static: libflint.a

tests: library test_helpers.o $(TESTS)
	$(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir)/test; BUILD_DIR=../build/$(dir); export BUILD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) tests || exit $$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach dir, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), mkdir -p build/$(dir)/test; BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) tests || exit $$?;))
	mkdir -p build/interfaces/test
	$(AT)if [ "$(WANT_NTL)" -eq "1" ]; then \
		$(MAKE) build/interfaces/test/t-NTL-interface; \
	fi

define test_mod
	$(eval vl := $(subst :, ,$(1)))
	$(eval dir := $(firstword $(vl)))
	$(eval uset_tests :=$(wordlist 2,$(words $(vl)),$(vl)))
	$(eval USER_SET_TESTS_VAR := USER_SET_TESTS=$(uset_tests))
	$(AT)test ! -d $(dir) || mkdir -p build/$(dir)/test; BUILD_DIR=../build/$(dir); export BUILD_DIR; test ! -d $(dir)  || $(MAKE) $(USER_SET_TESTS_VAR) -f ../Makefile.subdirs -C $(dir) check
endef

define test_mod_ext
	$(eval vl := $(subst :, ,$(1)))
	$(eval ext := $(2))
	$(eval dir := $(firstword $(vl)))
	$(eval uset_tests :=$(wordlist 2,$(words $(vl)),$(vl)))
	$(eval USER_SET_TESTS_VAR := USER_SET_TESTS=$(uset_tests))
	$(AT)MOD_DIR=$(dir); export MOD_DIR; test ! -d $(ext)/$(dir) || mkdir -p build/$(dir)/test; BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; test ! -d $(ext)/$(dir) || $(MAKE) $(USER_SET_TESTS_VAR) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) check
endef

check: library test_helpers.o
ifndef MOD
	$(AT)$(MAKE) $(TESTS)
	$(AT)(BUILD_DIR=build; export BUILD_DIR; $(MAKE) -f Makefile.subdirs -C . check || exit$$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach dir, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), mkdir -p build/$(dir)/test; BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) check || exit $$?;))
	$(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir)/test; BUILD_DIR=../build/$(dir); export BUILD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) check || exit $$?;)
	mkdir -p build/interfaces/test
	$(AT)if [ "$(WANT_NTL)" -eq "1" ]; then \
		$(MAKE) build/interfaces/test/t-NTL-interface; \
		build/interfaces/test/t-NTL-interface; \
	fi
else
	$(AT)$(foreach mod, $(MOD), $(call test_mod,$(mod)) || exit $$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach mod, $(MOD), $(call test_mod_ext,$(mod),$(ext)) || exit $$?;))
endif

valgrind: library
ifndef MOD
	$(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir)/test; BUILD_DIR=../build/$(dir); export BUILD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) valgrind || exit $$?;)
	$(AT)$(foreach ext, $(EXTENSIONS), $(foreach dir, $(patsubst $(ext)/%.h, %, $(wildcard $(ext)/*.h)), mkdir -p build/$(dir)/test; BUILD_DIR=$(CURDIR)/build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f $(CURDIR)/Makefile.subdirs -C $(ext)/$(dir) valgrind || exit $$?;))
else
	$(AT)$(foreach dir, $(MOD), mkdir -p build/$(dir)/test; BUILD_DIR=../build/$(dir); export BUILD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) valgrind || exit $$?;)
endif

install: library
	mkdir -p "$(DESTDIR)$(PREFIX)/$(LIBDIR)"
	mkdir -p "$(DESTDIR)$(PREFIX)/include/flint"
	$(AT)if [ "$(FLINT_SHARED)" -eq "1" ]; then \
	   cp $(FLINT_LIB) "$(DESTDIR)$(PREFIX)/$(LIBDIR)"; \
	   cp -a $(shell ls $(FLINT_LIBNAME)*) "$(DESTDIR)$(PREFIX)/$(LIBDIR)"; \
	fi
	$(AT)if [ "$(FLINT_STATIC)" -eq "1" ]; then \
		cp libflint.a "$(DESTDIR)$(PREFIX)/$(LIBDIR)"; \
	fi
	cp $(HEADERS) "$(DESTDIR)$(PREFIX)/include/flint"
	$(AT)if [ ! -z "$(EXT_HEADERS)" ]; then \
		cp $(EXT_HEADERS) "$(DESTDIR)$(PREFIX)/include/flint"; \
	fi
	mkdir -p "$(DESTDIR)$(PREFIX)/include/flint/flintxx"
	cp flintxx/*.h "$(DESTDIR)$(PREFIX)/include/flint/flintxx"
	cp *xx.h "$(DESTDIR)$(PREFIX)/include/flint"

build:
	mkdir -p build

build/CPimport.h: qadic/CPimport.txt build
	$(AT)sed "s/ /,/g;s/.*/&,/g" $< > $@

build/%.lo: %.c $(HEADERS) | build
	$(QUIET_CC) $(CC) $(PIC_FLAG) $(CFLAGS) $(INCS) -c $< -o $@;

build/%.o: %.c $(HEADERS) | build
	$(QUIET_CC) $(CC) $(CFLAGS) $(INCS) -c $< -o $@;

build/test/%$(EXEEXT): test/%.c $(HEADERS) | build/test
	$(QUIET_CC) $(CC) $(CFLAGS) $(INCS) $< -o $@ $(LIBS)

build/test:
	mkdir -p build/test

build/interfaces:
	mkdir -p build/interfaces

build/interfaces/NTL-interface.lo: interfaces/NTL-interface.cpp NTL-interface.h
	$(QUIET_CXX) $(CXX) $(PIC_FLAG) $(CXXFLAGS) $(INCS) -c $< -o $@

build/interfaces/NTL-interface.o: interfaces/NTL-interface.cpp NTL-interface.h
	$(QUIET_CXX) $(CXX) $(CXXFLAGS) $(INCS) -c $< -o $@

build/interfaces/test/t-NTL-interface$(EXEEXT): interfaces/test/t-NTL-interface.cpp build/interfaces/NTL-interface.o
	$(QUIET_CXX) $(CXX) $(CXXFLAGS) $(INCS) $< build/interfaces/NTL-interface.o -o $@ $(LIBS)

print-%:
	@echo '$*=$($*)'

.PHONY: profile library shared static clean examples tune check tests distclean dist install all valgrind