Add make example
Compiles and runs the examples in `share/isinetaddr/examples/`.
This commit is contained in:
parent
92d746ea9a
commit
a58f720cc1
1 changed files with 14 additions and 1 deletions
15
Makefile
15
Makefile
|
@ -2,6 +2,8 @@ SRCDIR = src
|
|||
SRCFILES = $(SRCDIR)/isinetaddr4.c $(SRCDIR)/iscidraddr4.c $(SRCDIR)/isinetaddr6.c
|
||||
INCDIR = include
|
||||
TESTDIR = test
|
||||
EXAMPLEDIR = share/isinetaddr/examples/
|
||||
EXAMPLEBIN = example
|
||||
|
||||
CC = cc
|
||||
CFLAGS = -fstack-protector-all -I$(INCDIR) -Wall -Wextra -pedantic
|
||||
|
@ -23,4 +25,15 @@ test6:
|
|||
@echo -n test/isinetaddr6: ''
|
||||
@$(TESTDIR)/isinetaddr6
|
||||
|
||||
.PHONY: test
|
||||
example:
|
||||
@for file in isinetaddr4.c iscidraddr4.c isinetaddr6.c ; do \
|
||||
echo Example: $$file; \
|
||||
$(CC) $(CFLAGS) $(SRCFILES) $(EXAMPLEDIR)/$$file -o $(EXAMPLEBIN); \
|
||||
./$(EXAMPLEBIN); \
|
||||
rm $(EXAMPLEBIN); \
|
||||
if [ $$file != isinetaddr6.c ]; then \
|
||||
echo; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
.PHONY: test example
|
||||
|
|
Loading…
Reference in a new issue