Skip to content

Commit ee31c24

Browse files
authored
build: polish Makevars files (#361)
1 parent dffe768 commit ee31c24

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

src/Makevars.in

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ STATLIB = $(LIBDIR)/$(LIBNAME)
88
PKG_LIBS = -L$(LIBDIR) -lprqlr
99

1010
CARGO_BUILD_ARGS = --lib \
11-
--profile "$(PROFILE)" \
11+
--profile="$(PROFILE)" \
1212
--manifest-path="$(CURDIR)/rust/Cargo.toml" \
13-
--target-dir "$(TARGET_DIR)" \
14-
--target $(TARGET)
13+
--target-dir="$(TARGET_DIR)" \
14+
--target=$(TARGET)
15+
16+
CARGOTMP = $(CURDIR)/.cargo
17+
VENDOR_DIR = $(CURDIR)/rust/vendor
1518

1619
.PHONY: all
1720
all: cleanup
1821

1922
$(SHLIB): $(STATLIB)
2023

21-
CARGOTMP = $(CURDIR)/.cargo
22-
VENDOR_DIR = $(CURDIR)/rust/vendor
23-
2424
$(STATLIB): remove-prev
2525
if [ -f "$(CURDIR)/../tools/$(LIBNAME)" ]; then \
2626
mkdir -p "$(LIBDIR)" ; \
@@ -56,8 +56,9 @@ remove-prev:
5656
.PHONY: cleanup
5757
# Clean up files that may cause warnings in R CMD check on CRAN just after the build
5858
cleanup: $(SHLIB)
59+
rm -Rf "$(CARGOTMP)" "$(VENDOR_DIR)"
5960
if [ "$(NOT_CRAN)" != "true" ]; then \
60-
rm -Rf "$(STATLIB)" "$(CARGOTMP)" "$(VENDOR_DIR)" "$(LIBDIR)/build"; \
61+
rm -Rf "$(STATLIB)" "$(LIBDIR)/build"; \
6162
fi
6263

6364
.PHONY: clean

src/Makevars.win.in

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ LIBNAME = libprqlr.a
66
TARGET_DIR = $(CURDIR)/rust/target
77
LIBDIR = $(TARGET_DIR)/$(TARGET)/$(subst dev,debug,$(PROFILE))
88
STATLIB = $(LIBDIR)/$(LIBNAME)
9-
PKG_LIBS = -L$(LIBDIR) -lprqlr -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll
9+
10+
PKG_LIBS = -L$(LIBDIR) -lprqlr \
11+
-lws2_32 \
12+
-ladvapi32 \
13+
-luserenv \
14+
-lbcrypt \
15+
-lntdll
1016

1117
CARGO_BUILD_ARGS = --lib \
12-
--profile "$(PROFILE)" \
18+
--profile="$(PROFILE)" \
1319
--manifest-path="$(CURDIR)/rust/Cargo.toml" \
14-
--target-dir "$(TARGET_DIR)" \
15-
--target $(TARGET)
20+
--target-dir="$(TARGET_DIR)" \
21+
--target=$(TARGET)
22+
23+
CARGOTMP = $(CURDIR)/.cargo
24+
VENDOR_DIR = $(CURDIR)/rust/vendor
25+
LIBGCC_MOCK_DIR = $(CURDIR)/libgcc_mock
1626

1727
# Rtools doesn't have the linker in the location that cargo expects, so we need
1828
# to overwrite it via configuration.
@@ -23,10 +33,6 @@ all: cleanup
2333

2434
$(SHLIB): $(STATLIB)
2535

26-
CARGOTMP = $(CURDIR)/.cargo
27-
VENDOR_DIR = $(CURDIR)/rust/vendor
28-
LIBGCC_MOCK_DIR = $(CURDIR)/libgcc_mock
29-
3036
$(STATLIB): remove-prev
3137
# When the GNU toolchain is used (i.e. on CRAN), -lgcc_eh is specified for
3238
# building proc-macro2, but Rtools doesn't contain libgcc_eh. This isn't used
@@ -60,8 +66,9 @@ remove-prev:
6066
.PHONY: cleanup
6167
# Clean up files that may cause warnings in R CMD check on CRAN just after the build
6268
cleanup: $(SHLIB)
69+
rm -Rf "$(CARGOTMP)" "$(VENDOR_DIR)"
6370
if [ "$(NOT_CRAN)" != "true" ]; then \
64-
rm -Rf "$(STATLIB)" "$(CARGOTMP)" "$(VENDOR_DIR)" "$(LIBDIR)/build"; \
71+
rm -Rf "$(STATLIB)" "$(LIBDIR)/build"; \
6572
fi
6673

6774
.PHONY: clean

0 commit comments

Comments
 (0)