From c39397640e3da32841f2b8d5b861b9545096f5fe Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 11 Oct 2016 10:32:37 -0700 Subject: [PATCH] makefile changes specify .POSIX: (already POSIX compliant, let's enforce POSIX behavior) clear suffix list and only include .c as it's all we need specify suffix rule .c to build binary and skip .o as it's not needed remove LD as we're not using it anymore remove OBJ as we're not building objects anymore remove unnecessary input redirection for sed in clean, remove all sinit tarballs not just for current VERSION --- Makefile | 21 +++++++++++---------- config.mk | 1 - 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 32ca146..83a0f68 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,23 @@ +.POSIX: +.SUFFIXES: +.SUFFIXES: .c +.PHONY: all install uninstall dist clean + +.c: + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< + include config.mk -OBJ = sinit.o BIN = sinit all: $(BIN) - -$(BIN): $(OBJ) - $(CC) $(LDFLAGS) -o $@ $(OBJ) - -$(OBJ): config.h +$(BIN): config.h install: all mkdir -p $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(MANPREFIX)/man8 - sed "s/VERSION/$(VERSION)/g" < $(BIN).8 > $(DESTDIR)$(MANPREFIX)/man8/$(BIN).8 + sed "s/VERSION/$(VERSION)/g" $(BIN).8 > $(DESTDIR)$(MANPREFIX)/man8/$(BIN).8 uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) @@ -28,9 +31,7 @@ dist: clean rm -rf sinit-$(VERSION) clean: - rm -f $(BIN) $(OBJ) sinit-$(VERSION).tar.gz + rm -f $(BIN) sinit-*.tar.gz config.h: cp config.def.h $@ - -.PHONY: all install uninstall dist clean diff --git a/config.mk b/config.mk index c1f87b4..37c87a1 100644 --- a/config.mk +++ b/config.mk @@ -6,7 +6,6 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man CC = cc -LD = $(CC) CPPFLAGS = CFLAGS = -Wextra -Wall -Os LDFLAGS = -s -static -- 2.10.0