From 226d807bb8bc0cdbc011b2e616ac02881e74c542 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 23 Nov 2025 21:33:38 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Makefile (limited to 'Makefile') 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 -- cgit v1.2.3-70-g09d2