seahag/Makefile

109 lines
3.2 KiB
Makefile
Raw Normal View History

2023-07-19 22:38:59 -04:00
# _,.---._ .-._ .--.-. ,--.--------.
# _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\
# /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./
# |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \
# |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \
# |==|,| | -|==| , '=' |==| - _ | |==|- |
# |==| '=' /\==\ - ,_ /|==| /\ , | |==|, |
# |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/
# `-.`.____.' `--`--'' `--`./ `--` `--`--`
# _ __ ,---. .-._ .=-.-. _,.----.
# .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \
# /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-'
# |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | .
# |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \
# |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , |
# |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. /
# /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-'
# `--`---' `--` `--`./ `--``--`-`
#
# @(#)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.
#
2023-08-22 22:47:15 -04:00
include config.mk
2023-07-19 23:42:04 -04:00
.SUFFIXES:
.SUFFIXES: .o .c
2023-08-22 22:47:15 -04:00
CFLAGS += -Wall -Werror
CFLAGS += -Iinclude
CFLAGS += -fPIC
hdrs += include/bytes.h
hdrs += include/haggis.h
2023-07-29 06:28:33 -04:00
hdrs += include/jobq.h
2023-09-17 19:09:44 -04:00
hdrs += include/mq.h
2023-08-28 20:50:29 -04:00
mans += man/haggis_node.3
srcs += bytes.c
srcs += haggis.c
srcs += jobq.c
2023-09-17 19:09:44 -04:00
srcs += mq.c
srcs += linkmap.c
2023-07-19 22:38:59 -04:00
2024-02-11 18:37:05 -05:00
binsrc += bin.c
objs = $(srcs:.c=.o)
all: shared static
2024-02-11 18:37:05 -05:00
bin: haggis
2023-08-10 10:22:09 -04:00
shared: libhaggis.so
static: libhaggis.a
$(srcs): $(hdrs)
2024-02-11 18:37:05 -05:00
$(binsrc): $(hdrs) $(srcs)
libhaggis.a: $(objs)
$(AR) rcs $@ $?
libhaggis.so: $(objs)
$(CC) -shared -o $@ $? $(LIBS)
2024-02-11 18:37:05 -05:00
haggis: $(binsrc) libhaggis.a
$(CC) -I./include -o $@ $?
2023-08-28 20:50:29 -04:00
install: install_include install_man install_shared install_static
install_include: include/haggis.h
@[ -d $(includedir) ] || install -d $(includedir)
install -m644 include/haggis.h $(includedir)/
2023-08-28 20:50:29 -04:00
install_man: $(mans)
@[ -d $(mandir)/man3 ] || install -d $(mandir)/man3
install -m644 $(mans) $(mandir)/man3/
install_static: libhaggis.a
@[ -d $(libdir) ] || install -d $(libdir)
install -m644 libhaggis.a $(libdir)/
install_shared: libhaggis.so
@[ -d $(libdir) ] || install -d $(libdir)
install -m755 libhaggis.so $(libdir)/
2023-08-09 11:41:06 -04:00
test: libhaggis.a
$(MAKE) -C test
testclean: clean
$(MAKE) -C test clean
2023-07-19 22:38:59 -04:00
clean:
2024-02-11 18:37:05 -05:00
rm -rf *.a *.so *.o haggis
2023-07-19 22:38:59 -04:00
2024-02-11 18:37:05 -05:00
.PHONY: all bin shared static clean install install_include install_man \
2023-08-28 20:50:29 -04:00
install_static install_shared testclean test