aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-11-23 21:33:38 +0100
committerMattias Andrée <m@maandree.se>2025-11-23 21:33:38 +0100
commit226d807bb8bc0cdbc011b2e616ac02881e74c542 (patch)
treee35bcc0f0b2bad8abfbb5da6db5580a813ca48bc /Makefile
downloadlibquanta-226d807bb8bc0cdbc011b2e616ac02881e74c542.tar.gz
libquanta-226d807bb8bc0cdbc011b2e616ac02881e74c542.tar.bz2
libquanta-226d807bb8bc0cdbc011b2e616ac02881e74c542.tar.xz
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--Makefile99
1 files changed, 99 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..26127d3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,99 @@
+.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 = quanta
+
+
+OBJ_PUBLIC =\
+ libquanta_palette_size.o\
+ libquanta_malloc_palette.o\
+ libquanta_vquantise.o\
+ libquanta_quantise.o\
+ libquanta_vquantise_wu.o\
+ libquanta_quantise_wu.o
+
+OBJ_PRIVATE =\
+ libquanta_bigint_divmod_small__.o
+
+OBJ =\
+ $(OBJ_PUBLIC)\
+ $(OBJ_PRIVATE)
+
+HDR =\
+ libquanta.h\
+ common.h
+
+LOBJ = $(OBJ:.o=.lo)
+
+MAN3 =\
+ $(OBJ_PUBLIC:.o=.3)\
+ struct_libquanta_image.3 libquanta_image.3\
+ struct_libquanta_channel.3 libquanta_channel.3\
+ struct_libquanta_palette.3 libquanta_palette.3\
+
+MAN7 = libquanta.7
+
+
+all: libquanta.a libquanta.$(LIBEXT)
+$(OBJ): $(HDR)
+$(LOBJ): $(HDR)
+
+.c.o:
+ $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+
+.c.lo:
+ $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+
+libquanta.a: $(OBJ)
+ @rm -f -- $@
+ $(AR) rc $@ $(OBJ)
+ $(AR) ts $@ > /dev/null
+
+libquanta.$(LIBEXT): $(LOBJ)
+ $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)
+
+install: libquanta.a libquanta.$(LIBEXT)
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7"
+ cp -- libquanta.a "$(DESTDIR)$(PREFIX)/lib/"
+ cp -- libquanta.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libquanta.$(LIBMINOREXT)"
+ $(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libquanta.$(LIBMINOREXT)"
+ ln -sf -- libquanta.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libquanta.$(LIBMAJOREXT)"
+ ln -sf -- libquanta.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libquanta.$(LIBEXT)"
+ cp -- libquanta.h "$(DESTDIR)$(PREFIX)/include/"
+ cp -P -- $(MAN3) "$(DESTDIR)$(MANPREFIX)/man3"
+ cp -P -- $(MAN7) "$(DESTDIR)$(MANPREFIX)/man7"
+
+uninstall:
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libquanta.a"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libquanta.$(LIBMAJOREXT)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libquanta.$(LIBMINOREXT)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libquanta.$(LIBEXT)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/include/libquanta.h"
+ -cd -- "$(DESTDIR)$(MANPREFIX)/man3" && rm -f -- $(MAN3)
+ -cd -- "$(DESTDIR)$(MANPREFIX)/man7" && rm -f -- $(MAN7)
+ -rmdir -- "$(DESTDIR)$(MANPREFIX)/man3"
+ -rmdir -- "$(DESTDIR)$(MANPREFIX)/man7"
+
+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