93 lines
2.9 KiB
Makefile
93 lines
2.9 KiB
Makefile
# _,.---._ .-._ .--.-. ,--.--------.
|
|
# _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\
|
|
# /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./
|
|
# |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \
|
|
# |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \
|
|
# |==|,| | -|==| , '=' |==| - _ | |==|- |
|
|
# |==| '=' /\==\ - ,_ /|==| /\ , | |==|, |
|
|
# |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/
|
|
# `-.`.____.' `--`--'' `--`./ `--` `--`--`
|
|
# _ __ ,---. .-._ .=-.-. _,.----.
|
|
# .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \
|
|
# /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-'
|
|
# |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | .
|
|
# |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \
|
|
# |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , |
|
|
# |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. /
|
|
# /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-'
|
|
# `--`---' `--` `--`./ `--``--`-`
|
|
#
|
|
# @(#)Copyright (c) 2024, 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
|
|
|
|
.SUFFIXES:
|
|
.SUFFIXES: .o .c
|
|
|
|
libname = epoch
|
|
|
|
CFLAGS += -Wall -Werror
|
|
CFLAGS += -Iinclude
|
|
CFLAGS += -fPIC
|
|
|
|
hdrs += include/epoch.h
|
|
|
|
srcs += datetime.c
|
|
srcs += epoch.c
|
|
srcs += month.c
|
|
srcs += weekday.c
|
|
srcs += year.c
|
|
srcs += zone.c
|
|
|
|
objs = $(srcs:.c=.o)
|
|
|
|
all: shared static
|
|
|
|
shared: lib$(libname).so
|
|
|
|
static: lib$(libname).a
|
|
|
|
$(srcs): $(hdrs)
|
|
|
|
lib$(libname).a: $(objs)
|
|
$(AR) rcs $@ $?
|
|
|
|
lib$(libname).so: $(objs)
|
|
$(CC) -shared -o $@ $? $(LIBS)
|
|
|
|
install: install_include install_shared install_static
|
|
|
|
install_include: include/$(libname).h
|
|
@[ -d $(includedir) ] || install -d $(includedir)
|
|
install -m644 include/$(libname).h $(includedir)/
|
|
|
|
install_static: lib$(libname).a
|
|
@[ -d $(libdir) ] || install -d $(libdir)
|
|
install -m644 lib$(libname) $(libdir)/
|
|
|
|
install_shared: lib$(libname).so
|
|
@[ -d $(libdir) ] || install -d $(libdir)
|
|
install -m755 lib$(libname).so $(libdir)/
|
|
|
|
test: lib$(libname).a
|
|
$(MAKE) -C test
|
|
|
|
testclean: clean
|
|
$(MAKE) -C test clean
|
|
|
|
clean:
|
|
rm -rf *.a *.so *.o
|
|
|
|
.PHONY: all shared static clean install install_include install_static \
|
|
install_shared testclean test
|