Skip to content

Commit bdb6067

Browse files
committed
Add rules for add-ons
1 parent 7d0899d commit bdb6067

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

tools/make/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ NPM ?= npm
77
# Define the command for `node`:
88
NODE ?= node
99

10+
# Define the C compiler:
11+
C_COMPILER ?= gcc
12+
13+
# Define the C++ compiler:
14+
CXX_COMPILER ?= g++
15+
16+
# Define the Fortran compiler:
17+
FORTRAN_COMPILER ?= gfortran
18+
19+
# Define the Fortran/C linker:
20+
LINKER ?= gfortran
21+
1022
# Define the command for removing files and directories:
1123
DELETE ?= -rm
1224
DELETE_FLAGS ?= -rf
@@ -29,6 +41,7 @@ include $(TOOLS_MAKE_LIB_DIR)/help/Makefile
2941
include $(TOOLS_MAKE_LIB_DIR)/init/Makefile
3042

3143
# Please keep sorted in alphabetical order:
44+
include $(TOOLS_MAKE_LIB_DIR)/addons/Makefile
3245
include $(TOOLS_MAKE_LIB_DIR)/benchmark/Makefile
3346
include $(TOOLS_MAKE_LIB_DIR)/bib/Makefile
3447
include $(TOOLS_MAKE_LIB_DIR)/complexity/Makefile

tools/make/lib/addons/Makefile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
# VARIABLES #
3+
4+
# Define the path of the executable for [node-gyp][1].
5+
#
6+
# [1]: https://github.com/nodejs/node-gyp
7+
8+
NODE_GYP ?= $(BIN_DIR)/node-gyp
9+
10+
# Define the C compiler:
11+
C_COMPILER ?= gcc
12+
13+
# Define the C++ compiler:
14+
CXX_COMPILER ?= g++
15+
16+
# Define the Fortran compiler:
17+
FORTRAN_COMPILER ?= gfortran
18+
19+
20+
# TARGETS #
21+
22+
# Install add-ons.
23+
#
24+
# This target installs native add-ons.
25+
26+
install-addons: $(NODE_GYP)
27+
$(QUIET) $(MAKE) -f $(this_file) list-pkgs-addons | while read -r pkg; do \
28+
echo ''; \
29+
echo "Add-on: $$pkg"; \
30+
echo 'Compiling source...'; \
31+
cd $$pkg/src && \
32+
C_COMPILER=$(C_COMPILER) \
33+
FORTRAN_COMPILER=$(FORTRAN_COMPILER) \
34+
$(MAKE); \
35+
echo 'Building add-on...'; \
36+
cd .. && $(NODE_GYP) rebuild; \
37+
done
38+
39+
.PHONY: install-addons
40+
41+
42+
# Remove add-ons.
43+
#
44+
# This target removes all compiled and generated files for native add-ons.
45+
46+
clean-addons:
47+
$(QUIET) $(MAKE) -f $(this_file) list-pkgs-addons | while read -r pkg; do \
48+
echo ''; \
49+
echo "Add-on: $$pkg"; \
50+
echo 'Cleaning source...'; \
51+
cd $$pkg/src && $(MAKE) clean; \
52+
echo 'Cleaning add-on...'; \
53+
cd .. && $(NODE_GYP) clean; \
54+
done
55+
56+
.PHONY: clean-addons

0 commit comments

Comments
 (0)