Merge pull request #5 from 0x1eef/make_examples

Add `make example`
This commit is contained in:
0x1eef 2023-09-15 01:48:00 -03:00 committed by GitHub
commit ee62519bb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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