# Makefile for rasgen # # @(#)$Id: Makefile,v 1.2 2018/09/28 05:49:13 jneitzel Exp $ # # Begin CONFIGURATION # # See the README file for build and install instructions. # # # Choose where and how to install the binary and manual page. # DESTDIR?= PREFIX?= /usr/local BINDIR?= $(PREFIX)/bin MANDIR?= $(PREFIX)/man/man1 BINMODE= -m 0555 MANMODE= -m 0444 # # Build utilities (SHELL must be POSIX-compliant) # CC?= INSTALL?= /usr/bin/install SHELL= /bin/sh BIN= rasgen MAN= $(BIN).1 SRC= $(BIN).c # # Preprocessor, compiler, and linker flags # # If the compiler gives errors about any of flags specified # by `OPTIONS' or `WARNINGS' below, comment the appropriate # line(s) with a `#' character to fix the compiler errors. # Then, try to build again by doing a `make clean ; make'. # #CPPFLAGS= OPTIONS= -std=c99 -pedantic WARNINGS= -Wall -Wextra # NOTE: It seems that -Wno-unused-result first appeared in gcc-4.4.0 . #WARNINGS= -Wno-unused-result #WARNINGS+= -Wshorten-64-to-32 CFLAGS+= $(OPTIONS) $(WARNINGS) #LDFLAGS+= -static #SPLINT=splint SPLINT=: SPARGS=-unrecog +posixlib # # End CONFIGURATION # # # Build targets # all: $(BIN) config.h: Makefile mkconfig $(SHELL) ./mkconfig $(BIN): $(SRC) config.h if ! $(SPLINT) $(SPARGS) $(SRC) ; then exit 0 ; fi $(CC) $(CFLAGS) $(CPPFLAGS) -o $(BIN) $(SRC) $(LIBS) # # Install targets # install: all test -d $(DESTDIR)$(BINDIR) || { \ umask 0022 ; mkdir -p $(DESTDIR)$(BINDIR) ; \ } test -d $(DESTDIR)$(MANDIR) || { \ umask 0022 ; mkdir -p $(DESTDIR)$(MANDIR) ; \ } $(INSTALL) -c -s $(BINMODE) $(BIN) $(DESTDIR)$(BINDIR) $(INSTALL) -c $(MANMODE) $(MAN) $(DESTDIR)$(MANDIR) # # Cleanup targets # clean: rm -f $(BIN) config.h