Skip to content

Commit

Permalink
Conform closer to GNU Makefile standard
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Nov 27, 2024
1 parent 93c6037 commit 0382fd3
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check.yml → .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ on:
- 'include/**'
- 'Makefile'
- '*.mk'
- '.github/workflows/check.yml'
- '.github/workflows/analyze.yml'

pull_request:
paths:
- 'src/**'
- 'include/**'
- 'Makefile'
- '*.mk'
- '.github/workflows/check.yml'
- '.github/workflows/analyze.yml'

jobs:

Expand All @@ -35,4 +35,4 @@ jobs:
run: sudo apt-get install -y cppcheck

- name: Run cppcheck
run: make check
run: make analyze
29 changes: 24 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,17 @@ solsys: $(SOLSYS_TARGETS)

# All of the above
.PHONY: all
all: distro static test coverage check
all: distro static test coverage analyze

# Run regression tests
.PHONY: test
test:
make -C test run

# Perform checks (test + analyze)
.PHONY: check
check: test analyze

# Measure test coverage (on test set of files only)
.PHONY: coverage
coverage:
Expand Down Expand Up @@ -201,7 +205,7 @@ INSTALL_PROGRAM ?= install
INSTALL_DATA ?= install -m 644

.PHONY: install
install: install-libs install-cio-data install-headers install-apidoc install-examples
install: install-libs install-cio-data install-headers install-html install-examples

.PHONY: install-libs
install-libs:
Expand All @@ -225,8 +229,8 @@ install-headers:
install -d $(DESTDIR)$(includedir)
$(INSTALL_DATA) -D include/* $(DESTDIR)$(includedir)/

.PHONY: install-apidoc
install-apidoc:
.PHONY: install-html
install-html:
ifneq ($(wildcard apidoc/html/search/*),)
@echo "installing API documentation to $(DESTDIR)$(htmldir)"
install -d $(DESTDIR)$(htmldir)/search
Expand All @@ -246,6 +250,20 @@ install-examples:
$(INSTALL_DATA) -D examples/* $(DESTDIR)$(docdir)


# Some standard GNU targets, that should always exist...
.PHONY: html
html: local-dox

.PHONY: dvi
dvi:

.PHONY: ps
ps:

.PHONY: pdf
pdf:


# Built-in help screen for `make help`
.PHONY: help
help:
Expand All @@ -265,8 +283,9 @@ help:
@echo " call implentations (e.g. 'solsys1.o', 'eph_manager.o'...)."
@echo " cio_ra.bin Generates a platform-specific binary CIO locator lookup data file"
@echo " 'cio_ra.bin' from the ASCII 'data/CIO_RA.TXT'."
@echo " check Performs static analysis with 'cppcheck'."
@echo " test Runs regression tests."
@echo " analyze Performs static code analysis with 'cppcheck'."
@echo " check Same as 'test' and then 'analyze'."
@echo " coverage Runs 'gcov' to analyze regression test coverage."
@echo " all All of the above."
@echo " install Install components (e.g. 'make prefix=<path> install')"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ all known solar systems bodies, down to the tiniest rocks.
<a name="calceph-integration"></a>
### Optional CALCEPH integration

The [CALCEPH](https://www.imcce.fr/recherche/equipes/asd/calceph/) library provides an easy-to-use access to JPL and
The [CALCEPH](https://www.imcce.fr/recherche/equipes/asd/calceph/) library provides easy-to-use access to JPL and
INPOP ephemeris files from C/C++. As of version 1.2, we provide optional support for interfacing SuperNOVAS with the
the CALCEPH C library for handling Solar-system objects.

Expand All @@ -1130,7 +1130,7 @@ code:
}

// -----------------------------------------------------------------------
// Optionally you may use a separate ephemeris data for major planets
// Optionally you may use a separate ephemeris dataset for major planets
// (or if planet ephemeris was included in 'eph' above, you don't have to)
t_calcephbin *pleph = calceph_open(...);
int status = novas_use_calceph(pleph);
Expand Down
6 changes: 3 additions & 3 deletions build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ clean: clean-local
distclean: distclean-local

# Static code analysis using 'cppcheck'
.PHONY: check
check:
@echo " [check]"
.PHONY: analyze
analyze:
@echo " [analyze]"
@cppcheck $(CPPFLAGS) $(CHECKOPTS) $(SRC)

# Doxygen documentation (HTML and man pages) under apidocs/
Expand Down
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CPPFLAGS += -I$(INC)

# Base compiler options (if not defined externally...)
# -std=c99 may not be supported by some very old compilers...
CFLAGS ?= -Os -Wall -std=c99
CFLAGS ?= -g -Os -Wall -std=c99

# Extra warnings (not supported on all compilers)
#CFLAGS += -Wextra
Expand Down

0 comments on commit 0382fd3

Please sign in to comment.