]> git.refcnt.org Git - colorize.git/blobdiff - Makefile
Omit declaration of optind/optarg
[colorize.git] / Makefile
index 57b59fa95e0e2b0d69f48a5716c5f250731f5d03..33b66a776bba5ff5328abb48d92b551de03dd758 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,35 @@
-.PHONY: clean
+.PHONY: check check_valgrind install clean release readme
 
 .SUFFIXES:
 .SUFFIXES: .c .o
 
 SHELL=/bin/sh
 CC=gcc
-CFLAGS=-Wall -Wextra -Wformat -Wswitch-default -Wuninitialized -Wunused -Wno-unused-function -Wno-unused-parameter
+CFLAGS:=-ansi -pedantic $(CFLAGS)
+FLAGS= # command-line macro
 
-colorize:      colorize.o
-                       $(CC) -o $@ $<
-
-colorize.o:    colorize.c
-                       $(CC) $(CFLAGS) -c $< -DCFLAGS="$(CFLAGS)"
+colorize:      colorize.c
+                       perl ./version.pl > version.h
+                       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o colorize colorize.c \
+  -DCPPFLAGS="\"$(CPPFLAGS)\"" -DCFLAGS="\"$(CFLAGS)\"" -DLDFLAGS="\"$(LDFLAGS)\"" \
+  -DHAVE_VERSION $(FLAGS)
 
 check:
-                       perl ./test.pl
+                       perl ./test.pl --regular
+
+check_valgrind:
+                       @which valgrind >/dev/null 2>&1 || (printf '%s\n' "valgrind not found" && exit 1)
+                       perl ./test.pl --valgrind || exit 0
+
+install:
+                       test ! -d $(DESTDIR)/usr/bin && mkdir -p $(DESTDIR)/usr/bin || exit 0
+                       cp colorize $(DESTDIR)/usr/bin
 
 clean:
-                       [ -e colorize.o ] && rm colorize.o; exit 0
+                       rm -f a.out colorize debug.txt version.h
+
+release:
+                       sh ./release.sh
+
+readme:
+                       perl ./readme.pl