aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2024-10-20 17:28:46 +0200
committerMattias Andrée <m@maandree.se>2024-10-20 17:28:46 +0200
commit09e6857ae73249bc7433f2971dcf291c70e4c766 (patch)
treef07ef152c6372083ab87e2e4289c7ab8b1f2c1ad /Makefile
parentThird commit (diff)
downloadlibtellurian-09e6857ae73249bc7433f2971dcf291c70e4c766.tar.gz
libtellurian-09e6857ae73249bc7433f2971dcf291c70e4c766.tar.bz2
libtellurian-09e6857ae73249bc7433f2971dcf291c70e4c766.tar.xz
Fourth commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile77
1 files changed, 72 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index d79bd06..99e7f4d 100644
--- a/Makefile
+++ b/Makefile
@@ -29,10 +29,12 @@ OBJ_PUBLIC =\
libtellurian_end_point_radians.o\
libtellurian_normal_gravity.o\
libtellurian_normal_gravity_radians.o\
+ libtellurian_effective_gravity.o\
+ libtellurian_effective_gravity_radians.o\
libtellurian_elevated_gravity.o\
libtellurian_elevated_gravity_radians.o\
- libtellurian_meridan_radius.o\
- libtellurian_meridan_radius_radians.o\
+ libtellurian_meridian_radius.o\
+ libtellurian_meridian_radius_radians.o\
libtellurian_transverse_radius.o\
libtellurian_transverse_radius_radians.o\
libtellurian_azimuthal_radius.o\
@@ -48,12 +50,46 @@ HDR =\
libtellurian.h\
common.h
+MAN0 = libtellurian.h.0
+MAN3 = $(MAN3_FUNC) $(MAN3_CONST)
+MAN7 = libtellurian.7
+
+MAN3_FUNC = $(OBJ_PUBLIC:.o=.3)
+
+MAN3_CONST =\
+ LIBTELLURIAN_EQUATORIAL_RADIUS.3\
+ LIBTELLURIAN_POLAR_RADIUS.3\
+ LIBTELLURIAN_MEAN_RADIUS.3\
+ LIBTELLURIAN_VOLUMETRIC_RADIUS.3\
+ LIBTELLURIAN_AUTHALIC_RADIUS.3\
+ LIBTELLURIAN_RECTIFYING_RADIUS.3\
+ LIBTELLURIAN_NOMINAL_EQUATORIAL_RADIUS.3\
+ LIBTELLURIAN_NOMINAL_POLAR_RADIUS.3\
+ LIBTELLURIAN_NOMINAL_RADIUS.3\
+ LIBTELLURIAN_EQUATORIAL_CIRCUMFERENCE.3\
+ LIBTELLURIAN_POLAR_CIRCUMFERENCE.3\
+ LIBTELLURIAN_MEAN_CIRCUMFERENCE.3\
+ LIBTELLURIAN_VOLUMETRIC_CIRCUMFERENCE.3\
+ LIBTELLURIAN_AUTHALIC_CIRCUMFERENCE.3\
+ LIBTELLURIAN_MERIDIONAL_CIRCUMFERENCE.3\
+ LIBTELLURIAN_EQUATORIAL_GRAVITY.3\
+ LIBTELLURIAN_POLAR_GRAVITY.3\
+ LIBTELLURIAN_NORMAL_EQUATORIAL_GRAVITY.3\
+ LIBTELLURIAN_NORMAL_POLAR_GRAVITY.3\
+ LIBTELLURIAN_MASS_OF_EARTH.3\
+ LIBTELLURIAN_ANGULAR_VELOCITY.3\
+ LIBTELLURIAN_GEOCENTRIC_GRAVITATIONAL_CONSTANT.3
+
LOBJ = $(OBJ:.o=.lo)
+TOBJ = $(OBJ:.o=.to)
+TEST = $(TOBJ:.to=.test)
-all: libtellurian.a libtellurian.$(LIBEXT)
+all: libtellurian.a libtellurian.$(LIBEXT) $(TEST)
$(OBJ): $(HDR)
$(LOBJ): $(HDR)
+$(TOBJ): $(HDR)
+$(TEST): libtellurian.a
.c.o:
$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
@@ -61,6 +97,12 @@ $(LOBJ): $(HDR)
.c.lo:
$(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+.c.to:
+ $(CC) -DTEST -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+
+.to.test:
+ $(CC) -o $@ $< libtellurian.a $(LDFLAGS)
+
libtellurian.a: $(OBJ)
@rm -f -- $@
$(AR) rc $@ $(OBJ)
@@ -69,15 +111,36 @@ libtellurian.a: $(OBJ)
libtellurian.$(LIBEXT): $(LOBJ)
$(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)
+check: $(TEST)
+ @for t in $(TEST); do\
+ printf '%s ' $(CHECK_PREFIX) ./$$t;\
+ printf '\n\033[31m';\
+ if ! $(CHECK_PREFIX) "./$$t"; then\
+ printf '\033[1m%s\n' 'TEST FAILED';\
+ fail=y;\
+ fi;\
+ printf '\033[m';\
+ done ; test -z "$$fail"
+
install: libtellurian.a libtellurian.$(LIBEXT)
mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man0"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7"
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/"
+ cp -P -- $(MAN0) "$(DESTDIR)$(MANPREFIX)/man0/"
+ cp -P -- $(MAN3_FUNC) "$(DESTDIR)$(MANPREFIX)/man3/"
+ set -e && for f in $(MAN3_CONST); do \
+ test ! -d "$(DESTDIR)$(MANPREFIX)/man3/$$f";\
+ ln -sf -- ../man0/libtellurian.h.0 "$(DESTDIR)$(MANPREFIX)/man3/$$f";\
+ done
+ cp -P -- $(MAN7) "$(DESTDIR)$(MANPREFIX)/man7/"
uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtellurian.a"
@@ -85,12 +148,16 @@ uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBMINOREXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtellurian.$(LIBEXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/include/libtellurian.h"
+ -cd -- "$(DESTDIR)$(MANPREFIX)/man0/" && rm -f -- $(MAN0)
+ -cd -- "$(DESTDIR)$(MANPREFIX)/man3/" && rm -f -- $(MAN3)
+ -cd -- "$(DESTDIR)$(MANPREFIX)/man7/" && rm -f -- $(MAN7)
clean:
-rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib
-rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT)
+ -rm -f -- *.to *.test
.SUFFIXES:
-.SUFFIXES: .lo .o .c
+.SUFFIXES: .lo .o .c .to .test
-.PHONY: all install uninstall clean
+.PHONY: all check install uninstall clean