Skip to content

Commit

Permalink
Makefile tweaks, README edits, and site update
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Nov 29, 2024
1 parent 91687d2 commit 7823c8c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Changes for the next feature release, expected around 1 February 2025.
- #97: Updated `NOVAS_PLANETS`, `NOVAS_PLANET_NAMES_INIT`, and `NOVAS_RMASS_INIT` macros to include the added planet
constants.

- Added `-g` to default `CFLAGS` as a matter of GNU best practice.


## [1.1.1] - 2024-10-28
Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,22 @@ the necessary variables in the shell prior to invoking `make`. For example:

- Choose which planet calculator function routines are built into the library (for example to provide
`earth_sun_calc()` set `BUILTIN_SOLSYS3 = 1` and/or for `planet_ephem_provider()` set `BUILTIN_SOLSYS_EPHEM = 1`.
You can then specify these functions (or others) as the default planet calculator for `ephemeris()` in your
You can then specify these functions (or others) as your planet calculator of choice for `ephemeris()` in your
application dynamically via `set_planet_provider()`.

- You can enable integration with the [CALCEPH](https://www.imcce.fr/recherche/equipes/asd/calceph/) C library, by
setting `CALCEPH_SUPPORT = 1` in `config.mk` or in the shell prior to the build. The build will require an
- [CALCEPH](https://www.imcce.fr/recherche/equipes/asd/calceph/) C library integration is automatic if `ldconfig` can
locate the `libcalceph` shared library. You can also control CALCEPH integration manually, e.g. by setting
`CALCEPH_SUPPORT = 1` in `config.mk` or in the shell prior to the build. CALCEPH integration will require an
accessible installation of the CALCEPH development files (C headers and unversioned static or shared libraries
depending on the needs of the build).

- You can enable integration with the [NAIF CSPICE Toolkit](https://naif.jpl.nasa.gov/naif/toolkit.html), by setting
`CSPICE_SUPPORT = 1` in `config.mk` or in the shell prior to the build. The build will require an accessible
installation of the CSPICE development files (C headers, under a `cspice/` sub-folder in the header search path,
and unversioned static or shared libraries depending on the needs of the build). You might want to check out the
[Smithsonian/cspice-sharedlib](https://github.com/Smithsonian/cspice-sharedlib) repository for building CSPICE as a
shared library.
- [NAIF CSPICE Toolkit](https://naif.jpl.nasa.gov/naif/toolkit.html) integration automatic, if `ldconfig` can locate
the `libcspice` shared library. You can also control CSPICE integration manually, e.g. by setting
`CSPICE_SUPPORT = 1` in `config.mk` or in the shell prior to the build. CSPICE integration will require an
accessible installation of the CSPICE development files (C headers, under a `cspice/` sub-folder in the header
search path, and unversioned static or shared libraries depending on the needs of the build). You might want to
check out the [Smithsonian/cspice-sharedlib](https://github.com/Smithsonian/cspice-sharedlib) repository for
building CSPICE as a shared library.

- Choose which stock planetary calculator module (if any) should provide a default `solarsystem()` implementation for
`ephemeris()` calls by setting `DEFAULT_SOLSYS` to 1 -- 3 for `solsys1.c` trough `solsys3.c`, respectively. If you
Expand Down Expand Up @@ -262,15 +264,15 @@ Or, to stage the installation (to `/usr`) under a 'build root':
## Building your application with SuperNOVAS

Provided you have installed the SuperNOVAS headers into a standard location, you can build your application against it
very easily. For example, to build `myastroapp.c` against SuperNOVAS, you might have a `Makefile` with contents like:
easily. For example, to build `myastroapp.c` against SuperNOVAS, you might have a `Makefile` with contents like:

```make
myastroapp: myastroapp.c
$(CC) -o $@ $(CFLAGS) $^ -lm -lsupernovas
```

If you have a legacy NOVAS C 3.1 application, it is possible that the compilation will give you errors due to missing
includes for `stdio.h`, `stdlib.h`, `ctype.h` or `string.h`. This is because these were explicitly included in
includes for `stdio.h`, `stdlib.h`, `ctype.h` or `string.h`. This is because these headers were explicitly included by
`novas.h` in NOVAS C 3.1, but not in SuperNOVAS (at least not by default), as a matter of best practice. If this is a
problem for you can 'fix' it in one of two ways: (1) Add the missing `#include` directives to your application source
explicitly, or if that's not an option for you, then (2) set the `-DCOMPAT=1` compiler flag when compiling your
Expand Down
31 changes: 25 additions & 6 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ DEFAULT_SOLSYS ?= 3
# LD_LIBRARY_PATH, and calceph.h in /usr/include or some other accessible
# location (you may also set an appropriate -I<path> option to CPPFLAGS
# prior to calling make).
CALCEPH_SUPPORT ?= 0
#CALCEPH_SUPPORT = 1


# Whether or not to build solsys-cspice libraries. You need the CSPICE
# development libraries (libcspice.so and/or libcspice.a) installed in
# LD_LIBRARY_PATH, and CSPICE header files in /usr/include/cspice or some
# other accessible location (you may also set an appropriate -I<path>
# option to CPPFLAGS prior to calling make).
CSPICE_SUPPORT ?= 0
#CSPICE_SUPPORT = 1


# cppcheck options for 'check' target. You can add additional options by
Expand Down Expand Up @@ -185,10 +185,29 @@ ifdef (DEFAULT_READEPH)
CPPFLAGS += -DDEFAULT_READEPH=1
endif


# Compiler and linker options etc.
ifeq ($(BUILD_MODE),debug)
CFLAGS += -g
# Use ldconfig (if available) to detect CALCEPH / CSPICE shared libs automatically
ifneq ($(shell which ldconfig), )
# Detect CALCEPH automatically, and enable support if present
ifndef CALCEPH_SUPPORT
ifneq ($(shell ldconfig -p | grep libcalceph), )
$(info INFO: CALCEPH support is enabled automatically.)
CALCEPH_SUPPORT = 1
else
$(info INFO: optional CALCEPH support is not enabled.)
CALCEPH_SUPPORT = 0
endif
endif

# Detect CSPICE automatically, and enable support if present
ifndef CPSICE_SUPPORT
ifneq ($(shell ldconfig -p | grep libcspice), )
$(info INFO: CSPICE support is enabled automatically.)
CSPICE_SUPPORT = 1
else
$(info INFO: optional CSPICE support is not enabled.)
CSPICE_SUPPORT = 0
endif
endif
endif

# Generate a list of object (obj/*.o) files from the input sources
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CIO_LOCATOR_FILE := cio_ra.bin
# Use above config in sub-makes also
export BUILTIN_SOLSYS3 BUILTIN_DEFAULT_SOLSYS CIO_LOCATOR_FILE

CFLAGS += -I../include -g -pg -Wall -fprofile-arcs -ftest-coverage
CFLAGS += -I../include -pg -Wall -fprofile-arcs -ftest-coverage
LDFLAGS += -fprofile-arcs -ftest-coverage -lm

include ../config.mk
Expand Down

0 comments on commit 7823c8c

Please sign in to comment.