aboutsummaryrefslogblamecommitdiffstats
path: root/Makefile
blob: d79bd06a970570cf1305eab7ce3d8fabc26aaec7 (plain) (tree)































































































                                                                                                   
.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