-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGNUmakefile
66 lines (51 loc) · 1.62 KB
/
GNUmakefile
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
# Makefile
# $Id: GNUmakefile,v 1.5 2006-08-24 09:14:43 hkuno Exp $
#----- rules -------------------------------------------------------------
TARGET=sunmoon.out
ifndef PREFIX
PREFIX=/usr/local
endif
CFLAGS=-Wall
.cpp.out:
$(CXX) $(CFLAGS) -DTEST -o $@ $< astro.a
#----- objects and sources -----------------------------------------------
SRC=vec3.cpp degree.cpp jday.cpp \
acoord.cpp atime.cpp \
planets.cpp
OBJ=$(SRC:.cpp=.o)
#----- target ------------------------------------------------------------
all: $(TARGET)
install: $(TARGET)
install $(TARGET) $(PREFIX)/bin/sunmoon
# for MacOS-X, Linux and Cygwin
sunmoon.out: sunmoon.o astro.a
$(CXX) $(CFLAGS) -o $@ $^
astro.a: $(OBJ)
ar cru $@ $^
ranlib $@
$(OBJ): defs.h GNUmakefile
#----- test --------------------------------------------------------------
test: jday.test atime.test acoord.test planets.test
jday.test: jday.out
perl -n -e "print if /^j/,/^g2000/;" jday.cpp >in.tmp
./jday.out <in.tmp >out.tmp
diff -w in.tmp out.tmp
atime.test: atime.out
perl -n -e "print if /^1997/../^1978/;" atime.cpp >in.tmp
./atime.out <in.tmp >out.tmp
diff -w in.tmp out.tmp
acoord.test: acoord.out
perl -n -e "print if /^1996/../^1997.11/;" acoord.cpp >in.tmp
./acoord.out <in.tmp >out.tmp
diff -w in.tmp out.tmp
planets.test: planets.out
perl -n -e "print if /^1991/../^conv: l=229/;" planets.cpp >in.tmp
./planets.out <in.tmp >out.tmp
diff -w in.tmp out.tmp
jday.out atime.out acoord.out planets.out: astro.a
#----- util --------------------------------------------------------------
clean:
$(RM) *.obj *.lib *.o *.a *.bak *.tmp
cleanall: clean
$(RM) *.exe *.map *.out
#end