-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathconfig.mk
More file actions
194 lines (155 loc) · 6.04 KB
/
config.mk
File metadata and controls
194 lines (155 loc) · 6.04 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# ===========================================================================
# Generic configuration options for building the SuperNOVAS libraries (both
# static and shared).
#
# You can include this snipplet in your Makefile also.
# ============================================================================
# Folders for compiled objects, libraries, and binaries, respectively
OBJ ?= obj
BIN ?= bin
# Default compiler to use (if not defined externally)
CC ?= gcc
# Default compiler options (if not defined externally)
CFLAGS ?= -g -Os -Wall
# Specific Doxygen to use if not the default one
#DOXYGEN ?= /opt/bin/doxygen
# To make SuperNOVAS thread-safe, we use thread-local storage modifier
# keywords. These were not standardized prior to C11. So while we automatically
# recognize C11 or GCC >= 3.3 to use the correct thread-local modifier keyword,
# for other compilers (e.g. Intel C, LLVM) you may need to specify it
# explicitly here by passing the keyword via the THREAD_LOCAL definition
#
# E.g.
#THREAD_LOCAL ?= __thread
#or
#THREAD_LOCAL ?= __declspec( thread )
# To build / install the C++ library (libsupernovas++)...
#ENABLE_CPP=1
# To compile library with an external or legacy `solarsystem()` /
# `solarsystem_hp()` implementation as the default planet provider, specify
# the source(s), which provide the implementation. (E.g. `legacy/solsys1.c
# legacy/eph_manager.c` or 'src/solsys-calceph.c`). If not set, then
# `solarsystem()` / `solatsystem_hp()` will be provided by the currently
# defined `novas_planet_provider` call, such as `src/solsys3.c`.
#SOLSYS_SOURCE = legacy/solsys1.c legacy/eph_manager.c
# To compile to use some user-supplied legacy `readeph()` implementation as
# the default ephemeris data provider, specify the source that will provide
# the implementation. If not set, SuperNOVAS will not provide a legacy
# `readeph()` implementation.
#READEPH_SOURCE = legacy/readeph0.c
# Whether or not to build solsys-calceph libraries. You need the calceph
# development libraries (libcalceph.so and/or libcaclceph.a) installed in
# 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 = 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 = 1
# cppcheck options for 'check' target. You can add additional options by
# setting the CHECKEXTRA variable (e.g. in shell) prior to invoking 'make'.
LANGUAGE ?= c
CHECKOPTS ?= --enable=performance,warning,portability,style --language=$(LANGUAGE) \
--error-exitcode=1 --std=c99
# Add-on ccpcheck options
CHECKOPTS += --inline-suppr $(CHECKEXTRA)
# Exhaustive checking for newer cppcheck...
#CHECKOPTS += --check-level=exhaustive
# ============================================================================
# END of user config section.
#
# Below are some generated constants based on the one that were set above
# ============================================================================
SUPERNOVAS_BUILD := 1
export SUPERNOVAS_BUILD
# The version of the shared .so libraries
SO_VERSION := 1
# If the THREAD_LOCAL variable was defined externally, use that definition to
# specify the thread local keyword to use.
ifdef THREAD_LOCAL
CPPFLAGS += -DTHREAD_LOCAL=\"$(THREAD_LOCAL)\"
endif
# Whether to use user-provided legacy `solarsystem()` / `solarsystem_hp()`
# functions as the default planetary ephemeris provider.
ifdef SOLSYS_SOURCE
SOURCES += $(SOLSYS_SOURCE)
CPPFLAGS += -DUSER_SOLSYS=1
endif
# Whether to use a legacy `readeph()` function as the default non-planetary
# ephemeris provider.
ifdef READEPH_SOURCE
SOURCES += $(READEPH_SOURCE)
CPPFLAGS += -DUSER_READEPH=1
endif
# Compile for specific C standard
ifdef CSTANDARD
CFLAGS += -std=$(CSTANDARD)
endif
# Extra warnings (not supported on all compilers)
ifeq ($(WEXTRA), 1)
CFLAGS += -Wextra
endif
# Add source code fortification checks
ifdef FORTIFY
CFLAGS += -D_FORTIFY_SOURCE=$(FORTIFY)
endif
# By default determine the build platform (OS type)
PLATFORM ?= $(shell uname -s)
# Platform-specific configurations
ifeq ($(PLATFORM),Darwin)
# macOS specific
SOEXT := dylib
SHARED_FLAGS := -dynamiclib -fPIC
SONAME_FLAG := -Wl,-install_name,@rpath/
LIB_PATH_VAR := DYLD_LIBRARY_PATH
else
# Linux/Unix specific
SOEXT := so
SHARED_FLAGS := -shared -fPIC
SONAME_FLAG := -Wl,-soname,
LIB_PATH_VAR := LD_LIBRARY_PATH
endif
# On Linux autodetect calceph / cspice libraties with ldconfig
ifeq ($(PLATFORM),Linux)
AUTO_DETECT_LIBS := 1
else
AUTO_DETECT_LIBS := 0
endif
ifeq ($(AUTO_DETECT_LIBS),1)
# Use ldconfig (if available) to detect CALCEPH / CSPICE shared libs
# automatically
ifndef CALCEPH_SUPPORT
ifneq ($(shell ldconfig -p | grep libcalceph), )
CALCEPH_SUPPORT = 1
endif
endif
ifndef CSPICE_SUPPORT
ifneq ($(shell ldconfig -p | grep libcspice), )
CSPICE_SUPPORT = 1
endif
endif
endif
SOURCES = target.c observer.c earth.c equator.c system.c transform.c cio.c \
orbital.c spectral.c grav.c nutation.c timescale.c frames.c place.c \
calendar.c refract.c naif.c parse.c util.c planets.c itrf.c \
ephemeris.c solsys3.c solsys-ephem.c moon.c
# Generate a list of object (obj/*.o) files from the input sources
OBJECTS := $(addprefix $(OBJ)/,$(subst .c,.o,$(SOURCES)))
# Default values for install locations
# See https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
prefix ?= /usr
exec_prefix ?= $(prefix)
libdir ?= $(exec_prefix)/lib
includedir ?= $(prefix)/include
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
mydatadir ?= $(datadir)/supernovas
docdir ?= $(datarootdir)/doc/supernovas
htmldir ?= $(docdir)/html
# Search for files in the designated locations
vpath %.h $(INC)
vpath %.o $(OBJ)
vpath %.d dep