-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathbsdmake
227 lines (189 loc) · 6.33 KB
/
bsdmake
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# Make file for console Find_Orb on BSD
# Based largely on 'makefile' (q.v.) written for GNU make
#
# Usage: make -f [path/]linmake [X=Y] [VT=Y] [tgt]
#
# where tgt can be any of:
# [all|find_orb|fo|fo_serve|clean|clean_temp|eph2tle|cssfield|neat_xvt]
#
# 'X' = use PDCurses instead of ncurses
# 'VT' = use PDCurses with VT platform (see github.com/Bill-Gray/PDCurses/vt)
#
# 'clean_temp' removes various temporary files made by Find_Orb and friends:
# orbital elements, covariance matrices, etc. 'clean' removes these _and_
# the more usual object and executable files.
CXX=c++
CC=cc
LIBSADDED=-L $(INSTALL_DIR)/lib -lm
EXE=
RM=rm -f
CURSES_LIB=-lncurses
CP = cp
# I'm using 'mkdir -p' to avoid error messages if the directory exists.
# It may fail on very old systems, and will probably fail on non-POSIX
# systems. If so, change to '-mkdir' and ignore errors.
MKDIR=mkdir -p
# You can have your include files in ~/include and libraries in
# ~/lib, in which case only the current user can use them; or
# (with root privileges) you can install them to /usr/local/include
# and /usr/local/lib for all to enjoy.
PREFIX?=~
.ifdef GLOBAL
INSTALL_DIR=/usr/local
.else
INSTALL_DIR=$(PREFIX)
.endif
.if $(PREFIX) != ~
# enable the automatic setup of ~/.find_orb dir from
# $PREFIX/share/openorb. This at the moment requires C++17 features
# and works on Linux and macOS
CXXFLAGS+=-DCONFIG_DIR_AUTOCOPY=1 -std=c++17
.endif
.ifdef X
CURSES_FLAGS=-DXCURSES -I../PDCursesMod
CURSES_LIB=-lXCurses -lXaw -lXmu -lXt -lX11 -lSM -lICE -lXext -lXpm
.endif
.ifdef VT
CURSES_FLAGS=-DVT -I$(HOME)/PDCursesMod
CURSES_LIB=-lpdcurses
.endif
LIB_DIR=$(INSTALL_DIR)/lib
.ifndef FO_EXE
FO_EXE=fo
FIND_ORB_EXE=find_orb
.endif
all: $(FO_EXE) $(FIND_ORB_EXE) fo_serve.cgi eph2tle$(EXE)
CXXFLAGS+=-c -Wall -pedantic -Wextra -Werror $(ADDED_CXXFLAGS) -I $(INSTALL_DIR)/include
.ifdef DEBUG
CXXFLAGS += -g -O0
.else
CXXFLAGS += -O3
.endif
OBJS=ades_out.o b32_eph.o bc405.o bias.o collide.o conv_ele.o details.o eigen.o \
elem2tle.o elem_out.o elem_ou2.o ephem0.o errors.o expcalc.o gauss.o \
geo_pot.o healpix.o lsquare.o miscell.o monte0.o \
mpc_obs.o nanosecs.o orb_func.o orb_fun2.o pl_cache.o roots.o \
runge.o shellsor.o sigma.o simplex.o sm_vsop.o sr.o stackall.o
LIBS=$(LIBSADDED) -llunar -ljpl -lsatell
FIND_ORB_OBJS = clipfunc.o getstrex.o
$(FIND_ORB_EXE): findorb.o $(FIND_ORB_OBJS) $(OBJS) $(RES_FILENAME)
$(CXX) -o $(FIND_ORB_EXE) findorb.o $(FIND_ORB_OBJS) $(OBJS) $(LIBS) $(CURSES_LIB) $(RES_FILENAME) $(LDFLAGS)
findorb.o: findorb.cpp
$(CXX) $(CXXFLAGS) $(CURSES_FLAGS) $<
clipfunc.o: clipfunc.cpp
$(CXX) $(CXXFLAGS) $(CURSES_FLAGS) $<
getstrex.o: getstrex.c
$(CC) $(CXXFLAGS) $(CURSES_FLAGS) $<
$(FO_EXE): fo.o $(OBJS) $(RES_FILENAME)
$(CXX) -o $(FO_EXE) fo.o $(OBJS) $(LIBS) $(RES_FILENAME) $(LDFLAGS)
eph2tle$(EXE): eph2tle.o conv_ele.o elem2tle.o simplex.o lsquare.o
$(CXX) -o eph2tle$(EXE) eph2tle.o conv_ele.o elem2tle.o simplex.o lsquare.o $(LIBS)
cssfield$(EXE): cssfield.o
$(CXX) -o cssfield$(EXE) cssfield.o $(LIBS)
expcalc$(EXE): expcalc.cpp
$(CXX) -o expcalc$(EXE) -Wall -Wextra -pedantic -DTEST_CODE expcalc.cpp
roottest$(EXE): roottest.o
$(CXX) -o roottest$(EXE) roottest.o roots.o
neat_xvt$(EXE): neat_xvt.o
$(CXX) -o neat_xvt$(EXE) neat_xvt.o
fo_serve.cgi: fo_serve.o $(OBJS)
$(CXX) -o fo_serve.cgi fo_serve.o $(OBJS) $(LIBS)
cvt_elem.cgi: cvt_elem.o
$(CXX) -o cvt_elem.cgi cvt_elem.o $(LIBS)
cvt_elem.o: conv_ele.cpp
$(CXX) $(CXXFLAGS) -o cvt_elem.o -DCGI_VERSION $<
IDIR=$(PREFIX)/share/findorb/data
.if $(PREFIX) == ~
# backwards compatibility
IDIR=~/.find_orb
.endif
clean:
$(RM) $(OBJS) fo.o findorb.o fo_serve.o $(FIND_ORB_EXE) $(FO_EXE)
$(RM) fo_serve.cgi eph2tle.o eph2tle$(EXE) cssfield$(EXE)
$(RM) $(FIND_ORB_OBJS) cssfield.o neat_xvt.o neat_xvt$(EXE)
$(RM) prefix.h PREFIX
.ifdef RES_FILENAME
$(RM) $(RES_FILENAME)
$(RES_FILENAME): find_orb.ico find_orb.rc
$(WINDRES) find_orb.rc -O coff -o $(RES_FILENAME)
.endif
clean_temp:
$(RM) $(IDIR)/artsat.json
$(RM) $(IDIR)/bc405pre.txt
$(RM) $(IDIR)/cmt_sof.txt
$(RM) $(IDIR)/combined.json
$(RM) $(IDIR)/covar.txt
$(RM) $(IDIR)/covar.json
$(RM) $(IDIR)/covar?.txt
$(RM) $(IDIR)/covar?.json
$(RM) $(IDIR)/debug.txt
$(RM) $(IDIR)/dummy.txt
$(RM) $(IDIR)/elem_?.json
$(RM) $(IDIR)/eleme?.txt
$(RM) $(IDIR)/eleme?.json
$(RM) $(IDIR)/elements.txt
$(RM) $(IDIR)/elements.json
$(RM) $(IDIR)/elem_short.json
$(RM) $(IDIR)/ephemeri.txt
$(RM) $(IDIR)/ephemeri.json
$(RM) $(IDIR)/gauss.out
$(RM) $(IDIR)/guide.txt
$(RM) $(IDIR)/guide?.txt
$(RM) $(IDIR)/linkage.json
$(RM) $(IDIR)/lock.txt
$(RM) $(IDIR)/monte.txt
$(RM) $(IDIR)/monte?.txt
$(RM) $(IDIR)/mpcorb.dat
$(RM) $(IDIR)/mpc_f?.txt
$(RM) $(IDIR)/mpc_fmt.txt
$(RM) $(IDIR)/mpc_s?.txt
$(RM) $(IDIR)/mpec.htm
$(RM) $(IDIR)/obser?.txt
$(RM) $(IDIR)/observe.txt
$(RM) $(IDIR)/observe.xml
$(RM) $(IDIR)/obs_temp.txt
$(RM) $(IDIR)/residual.txt
$(RM) $(IDIR)/sof.txt
$(RM) $(IDIR)/sof?.txt
$(RM) $(IDIR)/sofv?.txt
$(RM) $(IDIR)/sr_el?.txt
$(RM) $(IDIR)/sr_elems.txt
$(RM) $(IDIR)/state.txt
$(RM) $(IDIR)/state?.txt
$(RM) $(IDIR)/total.json
$(RM) $(IDIR)/total?.json
$(RM) $(IDIR)/vectors.txt
$(RM) $(IDIR)/virtu?.txt
$(RM) $(IDIR)/virtual.txt
INSTALL_FILES= \
bright.pgm bright2.pgm calendar.txt cometdef.sof command.txt cospar.txt \
details.txt dosephem.txt dos_help.txt elem_pop.txt environ.def \
eph2tle.txt eph_expl.txt eph_type.txt ?findorb.txt frame_he.txt \
geo_rect.txt header.htm hints.def jpl_eph.txt link_def.json mpc_area.txt \
mpcorb.hdr mu1.txt nongravs.txt obj_help.txt obj_name.txt \
ObsCodes.htm ObsCodesF.html observer.htm obslinks.htm \
odd_name.txt openfile.txt orbitdef.sof previous.def progcode.txt \
radecfmt.txt residfmt.txt rovers.txt sat_xref.txt scope.json \
scopes.txt splash.txt sigma.txt site_310.txt timehelp.txt xdesig.txt
install: all
$(MKDIR) $(IDIR)
.ifdef EXE
$(CP) $(FIND_ORB_EXE) $(IDIR)
$(CP) $(FO_EXE) $(IDIR)
.else
$(CP) $(FIND_ORB_EXE) $(INSTALL_DIR)/bin
$(CP) $(FO_EXE) $(INSTALL_DIR)/bin
.endif
$(CP) $(INSTALL_FILES) $(IDIR)
uninstall:
.ifdef EXE
rm -f $(IDIR)/$(FIND_ORB_EXE)
rm -f $(IDIR)/$(FO_EXE)
.else
rm -f $(INSTALL_DIR)/bin/$(FIND_ORB_EXE)
rm -f $(INSTALL_DIR)/bin/$(FO_EXE)
.endif
rm -f $(IDIR)/*
rmdir $(IDIR)
.cpp.o:
$(CXX) $(CXXFLAGS) $<