-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
724 lines (628 loc) · 28 KB
/
Copy pathMakefile
File metadata and controls
724 lines (628 loc) · 28 KB
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
GNU_MAKE_VERSION_MINIMUM := 4.3
ifeq ($(shell expr $(MAKE_VERSION) \< $(GNU_MAKE_VERSION_MINIMUM)), 1)
$(error MAKE_VERSION should be at least >= $(GNU_MAKE_VERSION_MINIMUM) ($(MAKE_VERSION)))
endif
# -----------------------------------------------------------------------
# Note:
# -----------------------------------------------------------------------
# - VERSION_MAJOR should be incremented
# whenever a big/revolutionary change to FloPoCo has been made.
# - VERSION_MINOR should be incremented whenever a new operator is added.
# - VERSION_PATCH when important bugfixes are made.
# -----------------------------------------------------------------------
FLOPOCO_VERSION_MAJOR := 5
FLOPOCO_VERSION_MINOR := 0
FLOPOCO_VERSION_PATCH := 0
FLOPOCO_VERSION := $(FLOPOCO_VERSION_MAJOR).$(FLOPOCO_VERSION_MINOR)
FLOPOCO_VERSION_FULL := $(FLOPOCO_VERSION).$(FLOPOCO_VERSION_PATCH)
FLOPOCO_BRANCH := $(shell git symbolic-ref --short HEAD)
FLOPOCO_COMMIT_HASH := $(shell git rev-parse HEAD)
CMAKE_VERSION := $(word 3,$(shell cmake --version))
CMAKE_VERSION_MAJOR := $(word 1,$(subst ., ,$(CMAKE_VERSION)))
# Actual (absolute) path to the repository's root Makefile
MKROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
# Number of jobs passed from command line:
MKJOBS := $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))
ifeq ($(MKJOBS),)
MKJOBS := 1
endif
# Local dependencies build directories:
BUILD_DIR := $(MKROOT)/build
BUILD_DEPENDENCIES_DIR := $(BUILD_DIR)/dependencies
BUILD_DEPENDENCIES_SOURCE_DIR := $(BUILD_DEPENDENCIES_DIR)/src
BUILD_DEPENDENCIES_BINARY_DIR := $(BUILD_DEPENDENCIES_DIR)/prefix
FLOPOCO := $(MKROOT)/build/bin/flopoco
# Utilities for parsing OS and distribution version
# as well as pretty-printing stuff.
include $(MKROOT)/tools/utilities.mk
ifeq ($(call file_exists, $(FLOPOCO)), 0)
FRESH_INSTALL := TRUE
$(call static_info, Clean installation of FloPoCo)
else
FRESH_INSTALL := FALSE
endif
# Print FloPoCo version, branch and commit hash:
$(call static_info, Running $(B)FloPoCo$(N) build script\
($(B)v$(FLOPOCO_VERSION_FULL)$(N)) on $(B)$(OS_PRETTY_NAME)$(N))
$(call static_info, Branch $(B)$(FLOPOCO_BRANCH)$(N))
$(call static_info, Commit $(B)#$(FLOPOCO_COMMIT_HASH)$(N))
$(call static_info, Running $(B)from$(N): $(PWD))
$(call static_info, Running with: $(B)-j$(MKJOBS)$(N))
$(call static_info, CMake version: $(B)$(CMAKE_VERSION)$(N))
ifndef MAKECMDGOALS # ------------------------
# This is just for info-printing purposes:
MAKECMDGOALS := all
endif # --------------------------------------
$(call static_info, $(B)Make targets$(N): $(MAKECMDGOALS))
# Detect if ninja is available, otherwise, use Makefiles:
ifeq ($(shell which ninja),) # --------
CMAKE_GENERATOR ?= "Unix Makefiles"
else # --------------------------------
CMAKE_GENERATOR ?= Ninja
endif # -------------------------------
# GUROBI_HOME can be set as an environment variable in the user's shell
# resource file (as recommended in the Gurobi installation manual)
# But it can also be added on-the-fly as a Makefile argument, e.g.:
# $ make GUROBI_HOME=/opt/gurobi1102/linux64
GUROBI_ROOT_DIR := $(GUROBI_HOME)
# DESTDIR used for system installation of the FloPoCo binaries/symlink:
DESTDIR ?= /usr/local
# By default, install all libraries and binaries in $(DESTDIR)
# when '$ make install' is used.
# Otherwise, if set to 'symlink', it will only
# install a symlink to the 'flopoco' binary in $(DESTDIR)
INSTALL_TYPE ?= system
# If ON (default), the script will take care of fetching and building SCIP
# locally, and integrate it with ScaLP.
WITH_SCIP ?= ON
# Adds NVC and its dependencies to the build process (OFF by default)
WITH_NVC ?= OFF
# Builds in RELEASE mode by default, otherwise, user can set it to 'DEBUG'
CONFIG ?= RELEASE
ifeq ($(CONFIG), DEBUG) # -------------------------
CMAKE_BUILD_TYPE := -DCMAKE_BUILD_TYPE=Debug
else
CMAKE_BUILD_TYPE := -DCMAKE_BUILD_TYPE=Release
endif # -------------------------------------------
$(call static_info, $(B)CONFIG$(N): $(CONFIG))
$(call static_info, $(B)CMAKE_GENERATOR$(N): $(CMAKE_GENERATOR))
$(call static_info, $(B)INSTALL_TYPE$(N): $(INSTALL_TYPE))
$(call static_info, $(B)DESTDIR$(N): $(DESTDIR))
$(call static_info, $(B)NVC building$(N): $(WITH_NVC))
# -----------------------------------------------------------------------------
ifeq ($(call file_exists, $(GUROBI_ROOT_DIR)/bin/gurobi.sh), 1)
# Try to find Gurobi from either $GUROBI_HOME environment variable or
# a user-defined path. If Gurobi can't be found, only SCIP will be used
# as a backend.
# -----------------------------------------------------------------------------
SCALP_BACKEND += GUROBI
$(call static_ok, Found $(B)Gurobi$(N) in $(GUROBI_ROOT_DIR))
ifeq ($(WITH_SCIP), ON)
# Add SCIP anyway, unless explicitly set OFF by the user
SCALP_BACKEND += SCIP
endif
else
# Otherwise, just use SCIP
SCALP_BACKEND := SCIP
endif
$(call static_info, $(B)ScaLP backend(s)$(N): $(SCALP_BACKEND))
# -----------------------------------------------------------------------------
all: flopoco
# -----------------------------------------------------------------------------
.PHONY: doxygen
# -----------------------------------------------------------------------------
doxygen:
@cd doc/doxygen
@doxygen Doxyfile
# -----------------------------------------------------------------------------
.PHONY: help
# -----------------------------------------------------------------------------
define help_cmd
Please visit: $(B)https://flopoco.org/flopoco_installation.html$(N)
for more build instructions:
$(U)$(I)Make targets$(N):
\t- $(B)all$(N) builds flopoco and its dependencies.
\t- $(B)dependencies$(N) only builds flopoco dependencies.
\t- $(B)docker$(N) builds flopoco in a docker image.
\t -$(B)doxygen$(N) builds doxygen documentation.
\t- $(B)install$(N) installs flopoco and its dependencies.
\t- $(B)clean$(N) removes current flopoco build.
\t- $(B)clean-dependencies$(N) removes dependencies builds.
\t- $(B)clean-all$(N) removes all builds.
$(U)$(I)Make Options$(N):
\t- $(B)CONFIG$(N) [$(B)RELEASE$(N) (default) | DEBUG]
\t- $(B)WITH_SCIP$(N) [$(B)$(G)ON$(N) (default) | OFF]
\t- $(B)WITH_NVC$(N) [ON | $(B)$(R)OFF$(N) (default)]
\t- $(B)GUROBI_HOME$(N) Path to your Gurobi installation
\t- $(B)BOOST_ROOT$(N) Path to your Boost installation
\t- $(B)DOCKER_BRANCH$(N) Selects flopoco branch for the docker image
\t (default: $(B)master$(N))
endef
help:
@echo "$(call help_cmd)"
# -----------------------------------------------------------------------------
.PHONY: clean
# -----------------------------------------------------------------------------
clean:
@mv $(BUILD_DEPENDENCIES_DIR) $(MKROOT)
@rm -rf $(BUILD_DIR)
@mkdir $(BUILD_DIR) && mv $(MKROOT)/dependencies $(BUILD_DIR)/
$(call shell_info, Removed current FloPoCo build)
$(call shell_info, Please run $(I)make clean-dependencies$(N) or $(I)make clean-all$(N) \
if you also wish to remove local build dependencies)
#-----------------------------------------------------------------------------
.PHONY: clean-dependencies
#-----------------------------------------------------------------------------
clean-dependencies:
$(call shell_info, Cleaning FloPoCo local dependencies)
@rm -rf $(BUILD_DEPENDENCIES_DIR)
#-----------------------------------------------------------------------------
.PHONY: clean-all
#-----------------------------------------------------------------------------
clean-all:
$(call shell_info, Removing all build artifacts)
@rm -rf $(BUILD_DIR)
# -----------------------------------------------------------------------------
.PHONY: docker
# Build docker images with the minimum required to run flopoco
# flopoco binary will be installed system-wide.
# -----------------------------------------------------------------------------
DOCKER_IMAGE ?= debian
DOCKER_IMAGE_SUPPORTED := ubuntu debian
DOCKERFILE := $(MKROOT)/Dockerfile
DOCKER_BRANCH ?= master
DOCKER_ARGS += --no-cache
FLOPOCO_DOCKER_TAG := flopoco:$(DOCKER_IMAGE)-$(FLOPOCO_VERSION_FULL)
# Check if the selected image is implemented in this script:
ifeq (docker, $(filter docker, $(MAKECMDGOALS)))
ifneq ($(DOCKER_IMAGE), $(filter $(DOCKER_IMAGE), $(DOCKER_IMAGE_SUPPORTED)))
$(call static_error, Unsupported $(B)DOCKER_IMAGE$(N) $(DOCKER_IMAGE))
$(call static_error, Supported images: $(DOCKER_IMAGE_SUPPORTED))
$(error Aborting...)
else
$(call static_ok, $(B)DOCKER_IMAGE$(N): $(DOCKER_IMAGE))
$(call static_ok, $(B)DOCKER_BRANCH$(N): $(DOCKER_BRANCH))
endif
endif
ifdef DOCKER_PROGRESS_PLAIN # --------------------------
# Display the full log of the image building process
DOCKER_ARGS += --progress=plain
endif # ------------------------------------------------
# -------------------------------------------------------------------------------
ifeq ($(DOCKER_IMAGE), debian)
# -------------------------------------------------------------------------------
define docker_script
FROM debian:latest
RUN apt update
RUN yes | apt install git make sudo ninja-build
RUN git clone https://gitlab.com/flopoco/flopoco
RUN cd flopoco \
&& git checkout $(DOCKER_BRANCH) \
&& make sysdeps \
&& make flopoco
VOLUME ["/flopoco_workspace"]
ENTRYPOINT ["/flopoco/build/flopoco"]
WORKDIR /flopoco_workspace
endef
# -------------------------------------------------------------------------------
else ifeq ($(DOCKER_IMAGE), ubuntu)
# -------------------------------------------------------------------------------
define docker_script
FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN yes | apt install git make sudo ninja-build
RUN git clone https://gitlab.com/flopoco/flopoco
RUN cd flopoco \
&& git checkout $(DOCKER_BRANCH) \
&& make sysdeps DEBIAN_FRONTEND=noninteractive \
&& make flopoco DEBIAN_FRONTEND=noninteractive
VOLUME ["/flopoco_workspace"]
ENTRYPOINT ["/flopoco/build/flopoco"]
WORKDIR /flopoco_workspace
endef
endif
# First, generate the Dockerfile, by calling the distro-dependent
# 'docker_script' macro
$(DOCKERFILE):
$(call shell_info, Generating $(B)Dockerfile$(N))
@echo '$(call docker_script)' > $(DOCKERFILE)
# Build from the generated Dockerfile, remove Dockerfile afterwards
docker: $(DOCKERFILE)
$(call shell_info, Building docker image $(B)$(FLOPOCO_DOCKER_TAG)$(N))
@docker build $(DOCKER_ARGS) -t $(FLOPOCO_DOCKER_TAG) $(MKROOT)
@rm -rf $(DOCKERFILE)
# -----------------------------------------------------------
.PHONY: sysdeps
# OS-dependent 'package-manager' dependency lists
# This should only be used for building docker images, and for the CI..
# -----------------------------------------------------------
ifeq ($(OS_ID), $(filter $(OS_ID), ubuntu debian))
# -----------------------------------------------------------
SYSDEPS += g++
SYSDEPS += cmake
SYSDEPS += ninja-build
SYSDEPS += liblapacke-dev
SYSDEPS += libsollya-dev
SYSDEPS += dh-autoreconf
SYSDEPS += flex
SYSDEPS += libboost-all-dev
SYSDEPS += pkg-config
SYSDEPS += libtbb-dev
define sysdeps_cmd
apt update
apt install -y $(SYSDEPS)
endef
NVC_DEPENDENCIES += build-essential
NVC_DEPENDENCIES += flex
NVC_DEPENDENCIES += llvm-dev
NVC_DEPENDENCIES += pkg-config
NVC_DEPENDENCIES += zlib1g-dev
NVC_DEPENDENCIES += libdw-dev
NVC_DEPENDENCIES += libffi-dev
NVC_DEPENDENCIES += libzstd-dev
define nvcdeps_cmd
apt update
yes | apt install $(NVC_DEPENDENCIES)
endef
define is_pkg_installed
dpkg -l $(1) >/dev/null || echo $(1)
endef
ifeq ($(MAKECMDGOALS), all)
ifeq ($(FRESH_INSTALL), TRUE)
$(call static_info, Now checking dependencies...)
MISSING_PKGS += $(strip $(foreach pkg,$(SYSDEPS),$(shell $(call is_pkg_installed,$(pkg)))))
# Note: dpkg sometimes lists 'flex' as installed, even if it's not...?!
# double check this one:
ifeq ($(shell which flex),)
MISSING_PKGS += flex
endif
ifneq ($(MISSING_PKGS),)
$(call static_error, The following packages are not installed: $(MISSING_PKGS))
$(call static_info, Please run '$$ (sudo) apt install $(MISSING_PKGS)' before using the script)
$(error Aborting...)
endif
endif
endif
# -----------------------------------------------------------
else ifeq ($(OS_ID), macos)
# macOS: homebrew (default) or macports
MACOS_PKG_MANAGER ?= brew
# -----------------------------------------------------------
# Common to both package managers (brew & port):
SYSDEPS += wget # brew: ok | macports: ok
SYSDEPS += cmake # brew: ok | macports: ok
SYSDEPS += gmp # brew: ok | macports: ok
SYSDEPS += mpfr # brew: ok | macports: ok
SYSDEPS += mpfi # brew: ok | macports: ok
SYSDEPS += boost # brew: ok | macports: ok
SYSDEPS += autoconf # brew: ok | macports: ok
SYSDEPS += automake # brew: ok | macports: ok
SYSDEPS += libtool # brew: ok | macports: ok
SYSDEPS += lapack # brew: ok | macports: ok
# ---------------------------------------------------------
ifeq ($(MACOS_PKG_MANAGER), brew)
# ---------------------------------------------------------
SYSDEPS += make # brew: ok | macports: gmake
SYSDEPS += pkg-config # brew: ok | macports: pkgconfig
SYSDEPS += sollya # brew: ok | macports: nope /!/
SYSDEPS += ninja # brew: ok | macports: nope /!/
define sysdeps_cmd
brew update && brew upgrade
brew install $(SYSDEPS)
endef
# ---------------------------------------------------------
else ifeq ($(MACOS_PKG_MANAGER), port)
# ---------------------------------------------------------
SYSDEPS += gmake
SYSDEPS += pkgconfig
define sysdeps_cmd
port selfupdate
port install $(SYSDEPS)
endef
endif # MACOS_PKG_MANAGER
# -----------------------------------------------------------
else # Unknown distro, do nothing
# -----------------------------------------------------------
define sysdeps_cmd
$(call shell_info, Linux distribution could not be identified, skipping...)
endef
endif # OS_ID
sysdeps:
$(call shell_info, Updating $(OS_ID) system $(B)dependencies$(N): $(SYSDEPS))
$(call sysdeps_cmd)
# Note: for building sollya: autoreconf -fi ./configure and make
# -----------------------------------------------------------------------------
.PHONY: scip
# Solver for mixed integer programming (MIP) and mixed integer
# nonlinear programming (MINLP)
# -----------------------------------------------------------------------------
SCIP_GIT := https://github.com/scipopt/scip.git
SCIP_VERSION := v922
SCIP_SOURCE_DIR := $(BUILD_DEPENDENCIES_SOURCE_DIR)/scip
SCIP_BINARY_DIR := $(BUILD_DEPENDENCIES_BINARY_DIR)
SCIP_LIBRARIES := $(SCIP_BINARY_DIR)/lib/libscip.$(dylib)
scip: $(SCIP_LIBRARIES)
.ONESHELL:
$(SCIP_LIBRARIES):
$(call shell_info, Fetching and building $(B)SCIP$(N) library)
@mkdir -p $(SCIP_BINARY_DIR)
@git clone $(SCIP_GIT) $(SCIP_SOURCE_DIR)
@cd $(SCIP_SOURCE_DIR)
@git checkout $(SCIP_VERSION)
@cmake -B build -G$(CMAKE_GENERATOR) \
-DAUTOBUILD=ON \
-DCMAKE_INSTALL_PREFIX=$(SCIP_BINARY_DIR) \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE \
$(CMAKE_BUILD_TYPE)
@cmake --build build --target install -j 8
# -----------------------------------------------------------------------------
.PHONY: gurobi
# -----------------------------------------------------------------------------
# Gurobi (TODO):
# - Linux(x86): https://packages.gurobi.com/11.0/gurobi11.0.2_linux64.tar.gz
# - Linux(arm): https://packages.gurobi.com/11.0/gurobi11.0.2_armlinux64.tar.gz
# - macOS: https://packages.gurobi.com/11.0/gurobi11.0.2_macos_universal2.pkg
# - The binaries can be downloaded without a license, but it is needed when
# the libraries and/or the executable are called
# -----------------------------------------------------------------------------
.PHONY: scalp
# Wrapper for different ILP-solvers, such as Gurobi, CPLEX, SCIP and LPSOLVE
# -----------------------------------------------------------------------------
SCALP_GIT := https://digidev.digi.e-technik.uni-kassel.de/git/scalp.git
SCALP_SOURCE_DIR := $(BUILD_DEPENDENCIES_SOURCE_DIR)/scalp
SCALP_BINARY_DIR := $(BUILD_DEPENDENCIES_BINARY_DIR)
SCALP_LIBRARIES += $(SCALP_BINARY_DIR)/lib/libScaLP.$(dylib)
scalp: $(SCALP_LIBRARIES)
SCALP_CMAKE_OPTIONS += -DUSE_LPSOLVE=OFF
SCALP_CMAKE_OPTIONS += $(CMAKE_BUILD_TYPE)
SCALP_CMAKE_OPTIONS += -DSOPLEX_DYN_LINK=OFF
ifeq ($(CMAKE_VERSION_MAJOR),4)
SCALP_CMAKE_OPTIONS += -DCMAKE_POLICY_VERSION_MINIMUM=3.5
endif
# -----------------------------------------------
ifeq (GUROBI, $(filter GUROBI, $(SCALP_BACKEND)))
# -----------------------------------------------
SCALP_DEPENDENCIES += $(GUROBI)
SCALP_CMAKE_OPTIONS += -DGUROBI_ROOT_DIR=$(GUROBI_ROOT_DIR)
SCALP_LIBRARIES += $(SCALP_BINARY_DIR)/lib/libScaLP-Gurobi.$(dylib)
endif
# -------------------------------------------
ifeq (SCIP, $(filter SCIP, $(SCALP_BACKEND)))
# -------------------------------------------
SCALP_DEPENDENCIES += $(SCIP_LIBRARIES)
SCALP_CMAKE_OPTIONS += -DSCIP_ROOT_DIR=$(SCIP_BINARY_DIR)
SCALP_LIBRARIES += $(SCALP_BINARY_DIR)/lib/libScaLP-SCIP.$(dylib)
endif
ifeq ($(OS_ID), alpine)
SCALP_CMAKE_OPTIONS += -DCMAKE_CXX_FLAGS=-U_FORTIFY_SOURCE
endif
.ONESHELL:
$(SCALP_LIBRARIES) &: $(SCALP_DEPENDENCIES)
$(call shell_info, Fetching and building $(B)ScaLP$(N) library)
@mkdir -p $(SCALP_BINARY_DIR)
@git clone $(SCALP_GIT) $(SCALP_SOURCE_DIR)
@cd $(SCALP_SOURCE_DIR)
@cmake -B build -G$(CMAKE_GENERATOR) \
-DCMAKE_INSTALL_PREFIX=$(SCALP_BINARY_DIR) \
$(SCALP_CMAKE_OPTIONS)
@cmake --build build --target install
# -----------------------------------------------------------------------------
.PHONY: wcpg
# Functions for reliable evaluation of the Worst-Case Peak Gain matrix
# of a discrete-time LTI filter.
# -----------------------------------------------------------------------------
WCPG_GIT := https://github.com/fixif/WCPG
WCPG_SOURCE_DIR := $(BUILD_DEPENDENCIES_SOURCE_DIR)/wcpg
WCPG_BINARY_DIR := $(BUILD_DEPENDENCIES_BINARY_DIR)
WCPG_LIBRARIES += $(WCPG_BINARY_DIR)/lib/libwcpg.$(dylib).0.0.9
WCPG_LIBRARIES += $(WCPG_BINARY_DIR)/lib/libwcpg.$(dylib).0
WCPG_LIBRARIES += $(WCPG_BINARY_DIR)/lib/libwcpg.$(dylib)
ifeq ($(OS_ID), macos) # ------------------------------------
# On macOS, for some reason, lapack homebrew installation
# can't be found, we have to explicitely set these
# additional flags:
WCPG_MACOS_FLAGS += -I/usr/local/opt/lapack/include
WCPG_MACOS_FLAGS += -L/usr/local/opt/lapack/lib
WCPG_CONFIGURE_FLAGS += --with-lapack=/usr/local/opt/lapack
WCPG_CONFIGURE_FLAGS += CFLAGS="$(WCPG_MACOS_FLAGS)"
endif # -----------------------------------------------------
wcpg: $(WCPG_LIBRARIES)
.ONESHELL:
$(WCPG_LIBRARIES) &:
$(call shell_info, Fetching and building $(B)WCPG$(N) library)
@mkdir -p $(WCPG_BINARY_DIR)
@git clone $(WCPG_GIT) $(WCPG_SOURCE_DIR)
@cd $(WCPG_SOURCE_DIR)
@bash autogen.sh
@./configure --prefix=$(WCPG_BINARY_DIR) $(WCPG_CONFIGURE_FLAGS)
@make -j8 install
# -----------------------------------------------------------------------------
.PHONY: pagsuite
# Optimization tools for the (pipelined) multiple constant multiplication
# ((P)MCM) problem, i.e., the multiplication of a single variable with
# multiple constants using bit-shifts, registered adders/subtractors
# and registers.
# -----------------------------------------------------------------------------
PAGSUITE_GIT := https://gitlab.com/kumm/pagsuite.git
PAGSUITE_SOURCE_DIR := $(BUILD_DEPENDENCIES_SOURCE_DIR)/pagsuite
PAGSUITE_BINARY_DIR := $(BUILD_DEPENDENCIES_BINARY_DIR)
PAGSUITE_LIBRARIES += $(PAGSUITE_BINARY_DIR)/lib/libpag.$(dylib)
PAGSUITE_LIBRARIES += $(PAGSUITE_BINARY_DIR)/lib/libpag.$(dylib).0
PAGSUITE_LIBRARIES += $(PAGSUITE_BINARY_DIR)/lib/libpag.$(dylib).2.1.0
PAGSUITE_LIBRARIES += $(PAGSUITE_BINARY_DIR)/lib/librpag.$(dylib)
PAGSUITE_LIBRARIES += $(PAGSUITE_BINARY_DIR)/lib/liboscm.$(dylib)
pagsuite: $(PAGSUITE_LIBRARIES)
.ONESHELL:
$(PAGSUITE_LIBRARIES) &: $(SCALP_LIBRARIES)
$(call shell_info, Fetching and building $(B)PAGSuite$(N) library)
@mkdir -p $(PAGSUITE_BINARY_DIR)
@git clone $(PAGSUITE_GIT) $(PAGSUITE_SOURCE_DIR)
@cd $(PAGSUITE_SOURCE_DIR)
@cmake -B build -G$(CMAKE_GENERATOR) \
-DSCALP_PREFIX_PATH=$(SCALP_BINARY_DIR) \
-DCMAKE_INSTALL_PREFIX=$(PAGSUITE_BINARY_DIR) \
$(CMAKE_BUILD_TYPE)
@cmake --build build --target install
# -----------------------------------------------------------------------------
.PHONY: nvc
# VHDL compiler and simulator.
# -----------------------------------------------------------------------------
NVC_GIT := https://github.com/nickg/nvc.git
NVC_SOURCE_DIR := $(BUILD_DEPENDENCIES_SOURCE_DIR)/nvc
NVC := $(NVC_SOURCE_DIR)/build/bin/nvc
nvc: $(NVC)
.ONESHELL:
$(NVC):
$(call shell_info, Fetching and building $(B)nvc$(N))
@git clone $(NVC_GIT) $(NVC_SOURCE_DIR)
@cd $(NVC_SOURCE_DIR)
@./autogen.sh
@mkdir build && cd build
@../configure
@make -j$(MKJOBS)
# -----------------------------------------------------------------------------
.PHONY: nvc-dependencies
# -----------------------------------------------------------------------------
nvc-dependencies:
$(call nvcdeps_cmd)
# -----------------------------------------------------------------------------
.PHONY: install-nvc
# -----------------------------------------------------------------------------
install-nvc: $(NVC)
@cd $(NVC_SOURCE_DIR)/build
@make install
# -----------------------------------------------------------------------------
.PHONY: dependencies
# -----------------------------------------------------------------------------
# PAGSuite needs scalp anyway.
#FLOPOCO_DEPENDENCIES += scalp
FLOPOCO_DEPENDENCIES += $(WCPG_LIBRARIES)
FLOPOCO_DEPENDENCIES += $(PAGSUITE_LIBRARIES)
FLOPOCO_DEPENDENCIES += $(shell find code/ -type f -name '*')
ifeq ($(WITH_NVC), ON)
FLOPOCO_DEPENDENCIES += $(NVC)
endif
dependencies: $(FLOPOCO_DEPENDENCIES)
# -----------------------------------------------------------------------------
.PHONY: flopoco
# -----------------------------------------------------------------------------
flopoco: $(FLOPOCO)
ifdef BOOST_ROOT
FLOPOCO_ADDITIONAL_FLAGS += -DBoost_ROOT=$(BOOST_ROOT)
else
FLOPOCO_ADDITIONAL_FLAGS :=
endif
ifeq ($(CMAKE_VERSION_MAJOR),4)
FLOPOCO_ADDITIONAL_FLAGS += -DCMAKE_POLICY_VERSION_MINIMUM=3.5
endif
ifeq ($(FRESH_INSTALL), TRUE) # ----------------------------------------
# The following commands are only executed in the case of a fresh
# flopoco installation. This prevents displaying the looong FloPoCo
# list of operators every time a re-make is done.
define epilogue # ------------------------------------------------------
$(call shell_info, Now running $(B)FloPoCo$(N))
$(FLOPOCO)
$(call shell_ok, If you saw the command-line help of FloPoCo - Welcome!)
endef # ----------------------------------------------------------------
endif
$(FLOPOCO) &: $(FLOPOCO_DEPENDENCIES)
$(call shell_info, Now building $(B)FloPoCo$(N))
@cmake -B build -G$(CMAKE_GENERATOR) \
-DCMAKE_PREFIX_PATH=$(BUILD_DEPENDENCIES_BINARY_DIR) \
-DCMAKE_INSTALL_PREFIX=$(DESTDIR) \
$(CMAKE_CXX_FLAGS) \
$(CMAKE_BUILD_TYPE) \
$(FLOPOCO_ADDITIONAL_FLAGS)
@cmake --build build || exit;
$(call shell_info, Adding 'flopoco' $(B)symlink$(N) in build directory)
@ln -fs $(FLOPOCO) $(MKROOT)/build
$(call shell_info, Building the $(B)HTML documentation$(N) in doc/web)
$(FLOPOCO) BuildHTMLDoc
$(call shell_info, Generating and installing $(B)bash autocompletion$(N) file)
$(FLOPOCO) BuildAutocomplete
$(call epilogue)
# -----------------------------------------------------------------------------
.ONESHELL:
.PHONY: install-dependencies
# -----------------------------------------------------------------------------
install-dependencies:
$(call shell_info, Now installing $(B)flopoco dependencies$(N) in $(DESTDIR))
cp -r $(BUILD_DEPENDENCIES_BINARY_DIR)/* $(DESTDIR)
# -----------------------------------------------------------------------------
.ONESHELL:
.PHONY: uninstall-dependencies
# -----------------------------------------------------------------------------
define find_file_with_suffix
$(shell find $(BUILD_DEPENDENCIES_BINARY_DIR) -type f,l,d -name '$(1)')
endef
INSTALLED_FILES += $(call find_file_with_suffix,*.a)
INSTALLED_FILES += $(call find_file_with_suffix,*.la)
INSTALLED_FILES += $(call find_file_with_suffix,*.so)
INSTALLED_FILES += $(call find_file_with_suffix,*.so.*)
INSTALLED_FILES += $(call find_file_with_suffix,*.h)
INSTALLED_FILES += $(call find_file_with_suffix,*.hpp)
INSTALLED_FILES += $(call find_file_with_suffix,*.cmake)
INSTALLED_FILES += $(call find_file_with_suffix,omcm)
INSTALLED_FILES += $(call find_file_with_suffix,oscm)
INSTALLED_FILES += $(call find_file_with_suffix,osr)
INSTALLED_FILES += $(call find_file_with_suffix,pag_fusion)
INSTALLED_FILES += $(call find_file_with_suffix,rpag)
INSTALLED_FILES += $(call find_file_with_suffix,scalp)
INSTALLED_FILES += $(call find_file_with_suffix,scip)
INSTALLED_FILES += $(call find_file_with_suffix,blockmemshell)
INSTALLED_FILES += $(call find_file_with_suffix,dijkstra)
INSTALLED_FILES += $(call find_file_with_suffix,lpi)
INSTALLED_FILES += $(call find_file_with_suffix,objscip)
INSTALLED_FILES += $(call find_file_with_suffix,pagsuite)
INSTALLED_FILES += $(call find_file_with_suffix,ScaLP)
INSTALLED_FILES += $(call find_file_with_suffix,symmetry)
INSTALLED_FILES += $(call find_file_with_suffix,tclique)
INSTALLED_FILES += $(call find_file_with_suffix,tinycthread)
INSTALLED_FILES += $(call find_file_with_suffix,tpi)
INSTALLED_FILES_PREFIX = $(foreach file,$(INSTALLED_FILES), \
$(subst $(BUILD_DEPENDENCIES_BINARY_DIR),$(realpath $(DESTDIR)),$(file)) \
)
uninstall-dependencies:
$(call shell_info, Now uninstalling $(B)flopoco dependencies$(N) in $(DESTDIR))
@rm -rf $(INSTALLED_FILES_PREFIX)
# -----------------------------------------------------------------------------
.ONESHELL:
.PHONY: install
# -----------------------------------------------------------------------------
ifeq ($(INSTALL_TYPE), symlink) # -----------------------------------------------
install: $(FLOPOCO)
$(call shell_info, Installing $(B)flopoco symlink$(N) in $(DESTDIR)/bin)
@ln -fs $(FLOPOCO) $(DESTDIR)/bin
else # ------------------------------------------------------------------------
install: $(FLOPOCO) install-dependencies
@cd $(MKROOT)
@cmake --build build --target install
endif
# -----------------------------------------------------------------------------
.ONESHELL:
.PHONY: autotests
# Run all flopoco level 0 autotests
# -----------------------------------------------------------------------------
autotests: $(FLOPOCO)
@$(FLOPOCO) autotest operator=all testlevel=0 output=autotests
# -----------------------------------------------------------------------------
.ONESHELL:
.PHONY: autotests-ci
# Run all CI autotests
# -----------------------------------------------------------------------------
autotests-ci: $(FLOPOCO)
@$(FLOPOCO) autotest operator=all output=autotests/std
@$(FLOPOCO) autotest operator=all frequency=100 output=autotests/pipeline
@$(FLOPOCO) autotest operator=all target=zynq7000 frequency=100 output=autotests/zynq7000
# -----------------------------------------------------------------------------
.ONESHELL:
.PHONY: autotests-deploy
# Run all CI autotests
# -----------------------------------------------------------------------------
autotests-deploy:
# -----------------------------------------------------------------------------
@autotests-html autotests/std/summary.csv \
autotests/pipeline/summary.csv \
autotests/zynq7000/summary.csv \
-c doc/web/autotests.csv