aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: d79bd06a970570cf1305eab7ce3d8fabc26aaec7 (plain) (blame)
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
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)

OS = linux
# Linux:   linux
# Mac OS:  macos
# Windows: windows
include mk/$(OS).mk


LIB_MAJOR = 1
LIB_MINOR = 0
LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
LIB_NAME = tellurian


OBJ_PUBLIC =\
	libtellurian_sea_level.o\
	libtellurian_sea_level_radians.o\
	libtellurian_coarse_distance.o\
	libtellurian_coarse_distance_radians.o\
	libtellurian_distance.o\
	libtellurian_distance_radians.o\
	libtellurian_azimuth.o\
	libtellurian_azimuth_radians.o\
	libtellurian_end_point.o\
	libtellurian_end_point_radians.o\
	libtellurian_normal_gravity.o\
	libtellurian_normal_gravity_radians.o\
	libtellurian_elevated_gravity.o\
	libtellurian_elevated_gravity_radians.o\
	libtellurian_meridan_radius.o\
	libtellurian_meridan_radius_radians.o\
	libtellurian_transverse_radius.o\
	libtellurian_transverse_radius_radians.o\
	libtellurian_azimuthal_radius.o\
	libtellurian_azimuthal_radius_radians.o\
	libtellurian_gaussian_radius.o\
	libtellurian_gaussian_radius_radians.o

OBJ =\
	$(OBJ_PUBLIC)\
	libtellurian_vincenty_inverse__.o

HDR =\
	libtellurian.h\
	common.h

LOBJ = $(OBJ:.o=.lo)


all: libtellurian.a libtellurian.$(LIBEXT)
$(OBJ): $(HDR)
$(LOBJ): $(HDR)

.c.o:
	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

.c.lo:
	$(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

libtellurian.a: $(OBJ)
	@rm -f -- $@
	$(AR) rc $@ $(OBJ)
	$(AR) ts $@ > /dev/null

libtellurian.$(LIBEXT): $(LOBJ)
	$(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)

install: libtellurian.a libtellurian.$(LIBEXT)
	mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
	mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
	cp -- libtellurian.a "$(DESTDIR)$(PREFIX)/lib/"
	cp -- libtellurian.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBMINOREXT)"
	$(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBMINOREXT)"
	ln -sf -- libtellurian.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBMAJOREXT)"
	ln -sf -- libtellurian.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBEXT)"
	cp -- libtellurian.h "$(DESTDIR)$(PREFIX)/include/"

uninstall:
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtellurian.a"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBMAJOREXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBMINOREXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBEXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/include/libtellurian.h"

clean:
	-rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib
	-rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT)

.SUFFIXES:
.SUFFIXES: .lo .o .c

.PHONY: all install uninstall clean