# _,.---._ .-._ .--.-. ,--.--------. # _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\ # /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./ # |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \ # |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \ # |==|,| | -|==| , '=' |==| - _ | |==|- | # |==| '=' /\==\ - ,_ /|==| /\ , | |==|, | # |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/ # `-.`.____.' `--`--'' `--`./ `--` `--`--` # _ __ ,---. .-._ .=-.-. _,.----. # .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \ # /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-' # |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | . # |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \ # |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , | # |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. / # /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-' # `--`---' `--` `--`./ `--``--`-` # # @(#)Copyright (c) 2023, Nathan D. Fisher. # # This is free software. It comes with NO WARRANTY. # Permission to use, modify and distribute this source code # is granted subject to the following conditions. # 1/ that the above copyright notice and this notice # are preserved in all copies and that due credit be given # to the author. # 2/ that any changes to this code are clearly commented # as such so that the author does not get blamed for bugs # other than his own. # -include config.mk PREFIX ?= /usr/local includedir = $(DESTDIR)$(PREFIX)/include libdir = $(DESTDIR)$(PREFIX)/lib srcs += src/haggis.c hdrs += include/haggis.h cflags += -Wall -Werror cflags += -Iinclude all: libhaggis.a libhaggis.so static: libhaggis.a shared: libhaggis.so install: install-headers install-shared install-static install-includedir: [ -d $(includedir) ] || install -d $(includedir) install-libdir: [ -d $(libdir) ] || install -d $(libdir) install-shared: libhaggis.so install-libdir install -m755 libhaggis.so $(libdir)/ install-static: libhaggis.a install-libdir install -m644 libhaggis.a $(libdir)/ install-headers: $(hdrs) install-includedir install -m644 $(hdrs) $(includedir)/ haggis.o: $(srcs) $(hdrs) $(CC) -c $(cflags) $(srcs) libhaggis.a: haggis.o $(AR) rcs $@ haggis.o haggis_shared.o: $(srcs) $(hdrs) $(CC) -c $(cflags) -fpic -o $@ $(srcs) libhaggis.so: haggis_shared.o $(CC) -shared -o $@ haggis_shared.o clean: rm -rf *.a *.so *.o .PHONY: all clean shared static install install-includedir install-libdir \ install-headers install-shared install-static