-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
140 lines (105 loc) · 6.57 KB
/
Makefile
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
# Makefile for EphemerisCompute
#
# -------------------------------------------------
# Copyright 2015-2024 Dominic Ford
#
# This file is part of EphemerisCompute.
#
# EphemerisCompute is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# EphemerisCompute is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EphemerisCompute. If not, see <http://www.gnu.org/licenses/>.
# -------------------------------------------------
CWD=$(shell pwd)
VERSION = 4.0
DATE = 23/09/2024
PATHLINK= /
WARNINGS = -Wall -Wno-format-truncation -Wno-unknown-pragmas
COMPILE = $(CC) $(WARNINGS) -g -c -I $(CWD)/src
LIBS = -lgsl -lgslcblas -lm
LINK = $(CC) $(WARNINGS) -g -fopenmp
LINK_SERIAL = $(CC) $(WARNINGS) -g
OPTIMISATION = -O3
DEBUG = -D DEBUG=1 -D MEMDEBUG1=1 -D MEMDEBUG2=0 -fopenmp
NODEBUG = -D DEBUG=0 -D MEMDEBUG1=0 -D MEMDEBUG2=0 -fopenmp
SERIAL = -D DEBUG=0 -D MEMDEBUG1=0 -D MEMDEBUG2=0
LOCAL_SRCDIR = src
LOCAL_OBJDIR = obj
LOCAL_BINDIR = bin
CORE_FILES = argparse/argparse.c coreUtils/asciiDouble.c coreUtils/errorReport.c coreUtils/makeRasters.c ephemCalc/constellations.c ephemCalc/magnitudeEstimate.c ephemCalc/meeus.c ephemCalc/jpl.c ephemCalc/orbitalElements.c listTools/ltDict.c listTools/ltList.c listTools/ltMemory.c listTools/ltStringProc.c mathsTools/julianDate.c mathsTools/precess_equinoxes.c mathsTools/sphericalAst.c settings/settings.c
CORE_HEADERS = argparse/argparse.h coreUtils/asciiDouble.h coreUtils/errorReport.h coreUtils/makeRasters.h coreUtils/strConstants.h ephemCalc/constellations.h ephemCalc/magnitudeEstimate.h ephemCalc/meeus.h ephemCalc/jpl.h ephemCalc/orbitalElements.h listTools/ltDict.h listTools/ltList.h listTools/ltMemory.h listTools/ltStringProc.h mathsTools/julianDate.h mathsTools/precess_equinoxes.h mathsTools/sphericalAst.h settings/settings.h
EPHEM_FILES = main.c
EPHEM_HEADERS =
ASTEROID_FILES = asteroids.c
ASTEROID_HEADERS =
CORE_SOURCES = $(CORE_FILES:%.c=$(LOCAL_SRCDIR)/%.c)
CORE_OBJECTS = $(CORE_FILES:%.c=$(LOCAL_OBJDIR)/%.o)
CORE_OBJECTS_DEBUG = $(CORE_OBJECTS:%.o=%.debug.o)
CORE_OBJECTS_SERIAL = $(CORE_OBJECTS:%.o=%.serial.o)
CORE_HFILES = $(CORE_HEADERS:%.h=$(LOCAL_SRCDIR)/%.h) Makefile
EPHEM_SOURCES = $(EPHEM_FILES:%.c=$(LOCAL_SRCDIR)/%.c)
EPHEM_OBJECTS = $(EPHEM_FILES:%.c=$(LOCAL_OBJDIR)/%.o)
EPHEM_OBJECTS_DEBUG = $(EPHEM_OBJECTS:%.o=%.debug.o)
EPHEM_OBJECTS_SERIAL = $(EPHEM_OBJECTS:%.o=%.serial.o)
EPHEM_HFILES = $(EPHEM_HEADERS:%.h=$(LOCAL_SRCDIR)/%.h) Makefile
ASTEROID_SOURCES = $(ASTEROID_FILES:%.c=$(LOCAL_SRCDIR)/%.c)
ASTEROID_OBJECTS = $(ASTEROID_FILES:%.c=$(LOCAL_OBJDIR)/%.o)
ASTEROID_OBJECTS_DEBUG = $(ASTEROID_OBJECTS:%.o=%.debug.o)
ASTEROID_OBJECTS_SERIAL = $(ASTEROID_OBJECTS:%.o=%.serial.o)
ASTEROID_HFILES = $(ASTEROID_HEADERS:%.h=$(LOCAL_SRCDIR)/%.h) Makefile
ALL_HFILES = $(CORE_HFILES) $(EPHEM_HFILES) $(ASTEROID_HFILES)
SWITCHES = -D DCFVERSION=\"$(VERSION)\" -D DATE=\"$(DATE)\" -D PATHLINK=\"$(PATHLINK)\" -D SRCDIR=\"$(CWD)/$(LOCAL_SRCDIR)/\"
all: $(LOCAL_BINDIR)/ephem.bin $(LOCAL_BINDIR)/debug/ephem.bin $(LOCAL_BINDIR)/serial/ephem.bin \
$(LOCAL_BINDIR)/asteroids.bin $(LOCAL_BINDIR)/debug/asteroids.bin $(LOCAL_BINDIR)/serial/asteroids.bin
#
# General macros for the compile steps
#
$(LOCAL_OBJDIR)/%.o: $(LOCAL_SRCDIR)/%.c $(ALL_HFILES)
mkdir -p $(LOCAL_OBJDIR) $(LOCAL_OBJDIR)/argparse $(LOCAL_OBJDIR)/coreUtils $(LOCAL_OBJDIR)/ephemCalc $(LOCAL_OBJDIR)/listTools $(LOCAL_OBJDIR)/mathsTools $(LOCAL_OBJDIR)/settings
$(COMPILE) $(OPTIMISATION) $(NODEBUG) $(SWITCHES) $< -o $@
$(LOCAL_OBJDIR)/%.debug.o: $(LOCAL_SRCDIR)/%.c $(ALL_HFILES)
mkdir -p $(LOCAL_OBJDIR) $(LOCAL_OBJDIR)/argparse $(LOCAL_OBJDIR)/coreUtils $(LOCAL_OBJDIR)/ephemCalc $(LOCAL_OBJDIR)/listTools $(LOCAL_OBJDIR)/mathsTools $(LOCAL_OBJDIR)/settings
$(COMPILE) $(OPTIMISATION) $(DEBUG) $(SWITCHES) $< -o $@
$(LOCAL_OBJDIR)/%.serial.o: $(LOCAL_SRCDIR)/%.c $(ALL_HFILES)
mkdir -p $(LOCAL_OBJDIR) $(LOCAL_OBJDIR)/argparse $(LOCAL_OBJDIR)/coreUtils $(LOCAL_OBJDIR)/ephemCalc $(LOCAL_OBJDIR)/listTools $(LOCAL_OBJDIR)/mathsTools $(LOCAL_OBJDIR)/settings
$(COMPILE) $(OPTIMISATION) $(SERIAL) $(SWITCHES) $< -o $@
#
# Make the ephemeris computer binaries
#
$(LOCAL_BINDIR)/ephem.bin: $(CORE_OBJECTS) $(EPHEM_OBJECTS)
mkdir -p $(LOCAL_BINDIR)
$(LINK) $(OPTIMISATION) $(CORE_OBJECTS) $(EPHEM_OBJECTS) $(LIBS) -o $(LOCAL_BINDIR)/ephem.bin
$(LOCAL_BINDIR)/debug/ephem.bin: $(CORE_OBJECTS_DEBUG) $(EPHEM_OBJECTS_DEBUG)
mkdir -p $(LOCAL_BINDIR)/debug
echo "The files in this directory are binaries with debugging options enabled: they produce activity logs called 'ephem.log'. It should be noted that these binaries can up to ten times slower than non-debugging versions." > $(LOCAL_BINDIR)/debug/README
$(LINK) $(OPTIMISATION) $(CORE_OBJECTS_DEBUG) $(EPHEM_OBJECTS_DEBUG) $(LIBS) -o $(LOCAL_BINDIR)/debug/ephem.bin
$(LOCAL_BINDIR)/serial/ephem.bin: $(CORE_OBJECTS_SERIAL) $(EPHEM_OBJECTS_SERIAL)
mkdir -p $(LOCAL_BINDIR)/serial
$(LINK_SERIAL) $(OPTIMISATION) $(CORE_OBJECTS_SERIAL) $(EPHEM_OBJECTS_SERIAL) $(LIBS) -o $(LOCAL_BINDIR)/serial/ephem.bin
#
# Make binaries for producing list of bright asteroids at opposition
#
$(LOCAL_BINDIR)/asteroids.bin: $(CORE_OBJECTS) $(ASTEROID_OBJECTS)
mkdir -p $(LOCAL_BINDIR)
$(LINK) $(OPTIMISATION) $(CORE_OBJECTS) $(ASTEROID_OBJECTS) $(LIBS) -o $(LOCAL_BINDIR)/asteroids.bin
$(LOCAL_BINDIR)/debug/asteroids.bin: $(CORE_OBJECTS_DEBUG) $(ASTEROID_OBJECTS_DEBUG)
mkdir -p $(LOCAL_BINDIR)/debug
echo "The files in this directory are binaries with debugging options enabled: they produce activity logs called 'ephem.log'. It should be noted that these binaries can up to ten times slower than non-debugging versions." > $(LOCAL_BINDIR)/debug/README
$(LINK) $(OPTIMISATION) $(CORE_OBJECTS_DEBUG) $(ASTEROID_OBJECTS_DEBUG) $(LIBS) -o $(LOCAL_BINDIR)/debug/asteroids.bin
$(LOCAL_BINDIR)/serial/asteroids.bin: $(CORE_OBJECTS_SERIAL) $(ASTEROID_OBJECTS_SERIAL)
mkdir -p $(LOCAL_BINDIR)/serial
$(LINK_SERIAL) $(OPTIMISATION) $(CORE_OBJECTS_SERIAL) $(ASTEROID_OBJECTS_SERIAL) $(LIBS) -o $(LOCAL_BINDIR)/serial/asteroids.bin
#
# Clean macros
#
clean:
rm -vfR $(LOCAL_OBJDIR) $(LOCAL_BINDIR)
afresh: clean all