socket-util.c

Socket helper utils
git clone git://git.finwo.net/lib/socket-util.c
Log | Files | Refs | README | LICENSE

Makefile (468B)


      1 CC = gcc
      2 CFLAGS = -Wall -Wextra -I../src -I. -Itest
      3 SRC = ../src/socket-util.c
      4 
      5 TESTS = $(wildcard *.test.c)
      6 BINS = $(TESTS:.test.c=)
      7 
      8 all: $(BINS)
      9 
     10 %: %.test.c $(SRC)
     11 	$(CC) $(CFLAGS) -o $@ $< $(SRC)
     12 
     13 run: all
     14 	@failed=0; \
     15 	for test in $(BINS); do \
     16 		echo "Running $$test..."; \
     17 		./$$test || failed=1; \
     18 	done; \
     19 	if [ $$failed -eq 1 ]; then \
     20 		echo "Some tests failed!"; \
     21 		exit 1; \
     22 	fi
     23 	@echo "All tests passed!"
     24 
     25 clean:
     26 	rm -f $(BINS)
     27 
     28 .PHONY: all run clean