aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-10-06 14:54:42 +0200
committerMattias Andrée <maandree@kth.se>2019-10-06 14:54:42 +0200
commitf5b396dd73ea28506286e0be09d5e76e802222a2 (patch)
treecfc285a83639e78858d954cf82815cefe10a55ce /Makefile
parentClean up (diff)
downloadlibred-f5b396dd73ea28506286e0be09d5e76e802222a2.tar.gz
libred-f5b396dd73ea28506286e0be09d5e76e802222a2.tar.bz2
libred-f5b396dd73ea28506286e0be09d5e76e802222a2.tar.xz
Simplify
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile53
1 files changed, 53 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2a747f0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,53 @@
+.POSIX:
+
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
+
+all: libred.a
+solar.o: solar.c libred.h
+blackbody.o: blackbody.c 10deg-xy.i 10deg-rgb.i libred.h
+
+10deg-xy.i: 10deg
+ sed -e 's/^/{/' -e 's/ /, /' -e 's/$$/},/' < 10deg | sed '$$s/,$$//' > $@
+
+generate-table: generate-table.c blackbody.c 10deg-xy.i libred.h
+ $(CC) -o $@ generate-table.c $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
+
+10deg-rgb.i: generate-table 10deg
+ ./generate-table > $@
+
+.c.o:
+ $(CC) -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
+
+libred.a: solar.o blackbody.o
+ $(AR) rc $@ $?
+ $(AR) s $@
+
+install: libred.a
+ 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 -- libred.a "$(DESTDIR)$(PREFIX)/lib"
+ cp -- libred.h "$(DESTDIR)$(PREFIX)/include"
+ cp -- libred.h.0 "$(DESTDIR)$(MANPREFIX)/man0"
+ cp -- libred_check_timetravel.3 libred_get_colour.3 libred_solar_elevation.3 "$(DESTDIR)$(MANPREFIX)/man3"
+ cp -- libred.7 "$(DESTDIR)$(MANPREFIX)/man7"
+
+uninstall:
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libred.a"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/include/libred.h"
+ -rm -f -- "$(DESTDIR)$(MANPREFIX)/man0/libred.h.0"
+ -rm -f -- "$(DESTDIR)$(MANPREFIX)/man3/libred_check_timetravel.3"
+ -rm -f -- "$(DESTDIR)$(MANPREFIX)/man3/libred_get_colour.3"
+ -rm -f -- "$(DESTDIR)$(MANPREFIX)/man3/libred_solar_elevation.3"
+ -rm -f -- "$(DESTDIR)$(MANPREFIX)/man7/libred.7"
+
+clean:
+ -rm -f -- generate-table *.i *.o *.a *.lo *.su *.so
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+.PHONY: all check install uninstall clean