This repository was archived by the owner on Nov 20, 2025. It is now read-only.
forked from stephenslab/susieR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
124 lines (108 loc) · 3.83 KB
/
Makefile
File metadata and controls
124 lines (108 loc) · 3.83 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
# Makefile for susieR package
.PHONY: all install document test test-coverage pkgdown lint style clean deep-clean check check-cran
# Default target
all: document install
## Install the package
install: document
@echo "Installing package..."
@Rscript -e "devtools::install('.', quiet = TRUE, upgrade = FALSE, build = FALSE)"
## Document the package (properly handling Rcpp compilation)
document:
@echo "Ensuring DESCRIPTION has final newline..."
@Rscript -e "lines <- readLines('DESCRIPTION'); writeLines(lines, 'DESCRIPTION')"
@echo "Creating minimal NAMESPACE if missing..."
@test -f NAMESPACE || ( echo "# Generated by roxygen2: do not edit by hand" > NAMESPACE && \
echo "" >> NAMESPACE )
@echo "Regenerating Rcpp exports..."
@Rscript -e "Rcpp::compileAttributes('.')"
@echo "Compiling shared library..."
@Rscript -e "pkgbuild::compile_dll('.')"
@echo "Documenting with roxygen2..."
@Rscript -e "roxygen2::roxygenise('.', clean = TRUE)"
## Run tests
test:
@echo "Running tests..."
@Rscript -e "devtools::test('.')"
## Test with coverage
test-coverage:
@echo "Running tests with coverage..."
@Rscript -e "covr::package_coverage('.')"
## Build pkgdown site
pkgdown: document
@echo "Building pkgdown site..."
@Rscript -e "pkgdown::clean_site('.')"
@Rscript -e "pkgdown::init_site('.')"
@Rscript -e "pkgdown::build_site('.', lazy = FALSE)"
pkgdown-lazy: document
@echo "Building pkgdown site (lazy mode - only changed pages)..."
@Rscript -e "pkgdown::build_site('.', lazy = TRUE)"
## Run lintr
lint:
@echo "Running lintr..."
@Rscript -e "lintr::lint_package('.')"
## Format code with styler
style:
@echo "Styling code..."
@Rscript -e "styler::style_pkg('.')"
## Basic check
check: document
@echo "Running basic checks..."
@Rscript -e "devtools::check('.', document = FALSE)"
## Run CRAN check
check-cran: document
@echo "Running CRAN checks..."
@Rscript -e "devtools::check('.', cran = TRUE, document = FALSE)"
## Clean generated files (KEEP NAMESPACE to avoid issues)
clean:
@echo "Cleaning generated files..."
@rm -f src/*.o src/*.so src/*.dll
@rm -f src/RcppExports.cpp R/RcppExports.R
@rm -rf man
@rm -f src/symbols.rds
@rm -rf *.tar.gz *.Rcheck
@echo "Clean complete (NAMESPACE preserved)"
## Deep clean (removes everything including NAMESPACE)
deep-clean:
@echo "Deep cleaning all generated files..."
@rm -f src/*.o src/*.so src/*.dll
@rm -f src/RcppExports.cpp R/RcppExports.R
@rm -rf man
@rm -f NAMESPACE
@rm -f src/symbols.rds
@rm -rf *.tar.gz *.Rcheck
@rm -rf .Rhistory .RData .Rproj.user
@rm -rf docs
@rm -rf inst/doc vignettes/*.html vignettes/*.R
@echo "Deep clean complete"
## Quick development workflow (when NAMESPACE exists)
quick:
@echo "Quick rebuild (assumes NAMESPACE exists)..."
@Rscript -e "Rcpp::compileAttributes('.')"
@Rscript -e "devtools::install('.', quick = TRUE, upgrade = FALSE)"
## Load package for interactive use
load:
@echo "Loading package..."
@Rscript -e "devtools::load_all('.')"
## Help
help:
@echo "susieR Makefile"
@echo ""
@echo "Main targets:"
@echo " make - Document and install (default)"
@echo " make document - Generate documentation (creates NAMESPACE if needed)"
@echo " make install - Install package"
@echo " make test - Run tests"
@echo " make test-coverage - Test coverage report"
@echo " make pkgdown - Build pkgdown site"
@echo " make lint - Run lintr"
@echo " make style - Format code with styler"
@echo " make check - Run R CMD check"
@echo " make check-cran - Run CRAN check"
@echo ""
@echo "Maintenance:"
@echo " make clean - Remove generated files (keeps NAMESPACE)"
@echo " make deep-clean - Remove ALL generated files"
@echo ""
@echo "Quick targets:"
@echo " make quick - Quick rebuild (when NAMESPACE exists)"
@echo " make load - Load package for interactive use"