2023-08-08 01:40:21 -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-09 11:41:06 -04:00
|
|
|
CFLAGS += -I../include
|
|
|
|
LIBS += ../libhaggis.a
|
|
|
|
LIBS += -lmd
|
2023-08-08 01:40:21 -04:00
|
|
|
|
2023-08-09 11:41:06 -04:00
|
|
|
tests += store_device
|
|
|
|
tests += load_device
|
|
|
|
total = 2
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: $(tests)
|
|
|
|
@printf "\n\tRunning %i tests\n\n" $(total)
|
|
|
|
@idx=1 ; success=0 ; fail=0; for t in $(tests) ; \
|
|
|
|
do printf "[%i/$(total)] \"$${t}\"\t" $${idx} ; \
|
|
|
|
idx=$$(expr $${idx} + 1) ; \
|
|
|
|
./$${t} ; \
|
|
|
|
if [ $$? -eq 0 ] ; \
|
|
|
|
then echo -e '\e[0;32mSuccess\e[0m' ; \
|
|
|
|
success=$$(expr $${success} + 1) ; \
|
|
|
|
else echo -e '\e[0;31mFailure\e[0m' ; \
|
|
|
|
fail=$$(expr $${fail} + 1) ; \
|
|
|
|
fi ; done ; \
|
|
|
|
printf "\nResults: %i succeeded, %i failed\n" $${success} $${fail}
|
|
|
|
|
|
|
|
output:
|
|
|
|
@ [-d $@ ] 2>/dev/null || install -d $@
|
|
|
|
|
|
|
|
store_device: store_device.c haggis_private.h output
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
|
|
|
|
|
|
|
|
load_device: load_device.c haggis_private.h output
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf $(tests) output/*
|