forked from Bill-Gray/find_orb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
153 lines (130 loc) · 4.43 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Make file for console Find_Orb, using regular Curses
# Use 'bsdmake' for BSD
# GNU MAKE Makefile for Find_Orb
#
# Usage: make -f [path/]linmake [CLANG=Y] [XCOMPILE=Y] [MSWIN=Y] [X=Y] [tgt]
#
# where tgt can be any of:
# [all|find_orb|fo|fo_serve|clean|clean_temp|eph2tle|cssfield]
#
# 'XCOMPILE' = cross-compile for Windows, using MinGW, on a Linux box
# 'MSWIN' = compile for Windows, using MinGW and PDCurses, on a Windows machine
# 'CLANG' = use clang instead of GCC; Linux only
# 'X' = use PDCurses instead of ncurses
# None of these: compile using g++ on Linux, for Linux
#
# '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.
CURSES_LIB=-lncursesw
CC=g++
LIBSADDED=-L $(INSTALL_DIR)/lib -lm
EXE=
OBJSADDED=
RM=rm -f
ifdef CLANG
CC=clang
endif
# 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.
ifdef MSWIN
LIBSADDED=-static-libgcc
EXE=.exe
OBJSADDED=clipfunc.o
CURSES_LIB=-lpdcurses
MKDIR=-mkdir
else
MKDIR=mkdir -p
endif
# 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.
ifdef GLOBAL
INSTALL_DIR=/usr/local
else
INSTALL_DIR=~
endif
ifdef X
ADDED_CFLAGS=-DXCURSES -DPDC_WIDE -I../PDCurses
CURSES_LIB=-lXCurses -lXaw -lXmu -lXt -lX11 -lSM -lICE -lXext -lXpm
endif
ifdef XCOMPILE
CC=x86_64-w64-mingw32-g++
ADDED_CFLAGS=-DUTF8 -DPDC_WIDE -I $(INSTALL_DIR)/include -I../PDCurses
OBJSADDED=clipfunc.o
EXE=.exe
CURSES_LIB=-lpdcurses -static-libgcc
LIBSADDED=-L $(INSTALL_DIR)/win_lib -lm -lgdi32 -luser32 -mwindows
endif
all: fo$(EXE) find_orb$(EXE) fo_serve.cgi eph2tle$(EXE)
CFLAGS=-c -O3 -Wall -pedantic -Wextra -Wno-unused-parameter -I $(INSTALL_DIR)/include
OBJS=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 gauss.o \
geo_pot.o healpix.o lsquare.o miscell.o moid4.o monte0.o \
mpc_obs.o mt64.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 $(OBJSADDED)
LIBS=$(LIBSADDED) -llunar -ljpl -lsatell
find_orb$(EXE): findorb.o $(OBJS)
$(CC) -o find_orb$(EXE) findorb.o $(OBJS) $(LIBS) $(CURSES_LIB)
fo$(EXE): fo.o $(OBJS)
$(CC) -o fo$(EXE) fo.o $(OBJS) $(LIBS)
eph2tle$(EXE): eph2tle.o conv_ele.o elem2tle.o simplex.o lsquare.o
$(CC) -o eph2tle$(EXE) eph2tle.o conv_ele.o elem2tle.o simplex.o lsquare.o $(LIBS)
cssfield$(EXE): cssfield.o
$(CC) -o cssfield$(EXE) cssfield.o $(LIBS)
fo_serve.cgi: fo_serve.o $(OBJS)
$(CC) -o fo_serve.cgi fo_serve.o $(OBJS) $(LIBS)
IDIR=$(HOME)/.find_orb
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) cssfield.o
clean_temp:
$(RM) $(IDIR)/bc405pre.txt
$(RM) $(IDIR)/cmt_sof.txt
$(RM) $(IDIR)/covar.txt
$(RM) $(IDIR)/covar?.txt
$(RM) $(IDIR)/debug.txt
$(RM) $(IDIR)/eleme?.txt
$(RM) $(IDIR)/elements.txt
$(RM) $(IDIR)/ephemeri.txt
$(RM) $(IDIR)/gauss.out
$(RM) $(IDIR)/guide.txt
$(RM) $(IDIR)/guide?.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)/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)/vectors.txt
$(RM) $(IDIR)/virtu?.txt
$(RM) $(IDIR)/virtual.txt
install:
-cp find_orb $(HOME)/bin
cp fo $(HOME)/bin
$(MKDIR) $(IDIR)
cp command.txt details.txt dosephem.txt dos_help.txt ?findorb.txt $(IDIR)
cp environ.def geo_rect.txt header.htm jpl_eph.txt mpcorb.hdr $(IDIR)
cp mu1.txt observer.txt obslinks.htm ObsCodes.htm ObsCodesF.html $(IDIR)
cp odd_name.txt rovers.txt scopes.txt sigma.txt xdesig.txt $(IDIR)
uninstall:
rm -f $(HOME)/bin/find_orb
rm -f $(HOME)/bin/fo
rm -f $(IDIR)/*
rmdir $(IDIR)
.cpp.o:
$(CC) $(CFLAGS) $(ADDED_CFLAGS) $<