aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-06-06 13:55:17 +0200
committerMattias Andrée <maandree@kth.se>2017-06-06 13:59:36 +0200
commite047ec28ef55bc5a2bb8b1790201e51d02eb5a12 (patch)
tree28f7dacb5d45dbe7aa252f53a18187208fc6464a /Makefile
parentPrepare for release (diff)
downloadlibcolour-e047ec28ef55bc5a2bb8b1790201e51d02eb5a12.tar.gz
libcolour-e047ec28ef55bc5a2bb8b1790201e51d02eb5a12.tar.bz2
libcolour-e047ec28ef55bc5a2bb8b1790201e51d02eb5a12.tar.xz
Remove a much of stuff, change license, and add support for float and long double
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile62
1 files changed, 62 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..acfc5b5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,62 @@
+.POSIX:
+
+include config.mk
+
+OBJ =\
+ float.o\
+ double.o\
+ long-double.o
+
+HDR =\
+ libcolour.h
+
+TEMPLATES =\
+ convert-template.c\
+ libcolour-template.c
+
+
+all: libcolour.a libcolour.so.$(VERSION_MAJOR).$(VERSION_MINOR) test
+
+
+float.o: float.c $(TEMPLATES) $(HDR)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ float.c
+
+double.o: double.c $(TEMPLATES) $(HDR)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ double.c
+
+long-double.o: long-double.c $(TEMPLATES) $(HDR)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ long-double.c
+
+
+float.pic.o: float.c $(TEMPLATES) $(HDR)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ float.c
+
+double.pic.o: double.c $(TEMPLATES) $(HDR)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ double.c
+
+long-double.pic.o: long-double.c $(TEMPLATES) $(HDR)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ long-double.c
+
+
+libcolour.a: $(OBJ)
+ $(AR) rc $@ $?
+ $(AR) -s $@
+
+libcolour.so.$(VERSION_MAJOR).$(VERSION_MINOR): $(OBJ:.o=.pic.o)
+ $(CC) -shared -Wl,-soname,libcolour.so.$(VERSION_MAJOR) -o $@ $(LDFLAGS) $^
+
+
+test.o: test.c libcolour.h
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ test.c
+
+test: test.o libcolour.a
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+
+check: test
+ ./test
+
+clean:
+ -rm -- *.o *.a *.so *.so.* test
+
+.PHONY: all clean check