[hackers] [sinit] Simplify Makefile || sin
commit fd8710d8a5f90ea3677b2f9afe3138be94f7b38e
Author: sin <sin_AT_2f30.org>
Date: Thu Dec 4 14:18:36 2014 +0000
Simplify Makefile
diff --git a/Makefile b/Makefile
index 1b7867f..a3d253f 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -1,62 +1,39 @@
include config.mk
-.POSIX:
-.SUFFIXES: .c .o
+OBJ = sinit.o
+BIN = sinit
-SRC = sinit.c
+all: $(BIN)
-OBJ = $(SRC:.c=.o)
-BIN = $(SRC:.c=)
+$(BIN): $(OBJ)
+ $(CC) $(LDFLAGS) -o $_AT_ $(OBJ) $(LDLIBS)
-all: options bin
+sinit.o: config.h
-options:
- _AT_echo sinit build options:
- _AT_echo "CFLAGS = $(CFLAGS)"
- _AT_echo "LDFLAGS = $(LDFLAGS)"
- _AT_echo "CC = $(CC)"
-
-bin: $(BIN)
-
-$(OBJ): config.h config.mk
-
-config.h:
- _AT_echo creating $@ from config.def.h
- _AT_cp config.def.h $@
-
-.o:
- _AT_echo LD $@
- _AT_$(LD) -o $@ $< $(LDFLAGS)
+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
-.c.o:
- _AT_echo CC $<
- _AT_$(CC) -c -o $@ $< $(CFLAGS)
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
+ rm -f $(DESTDIR)$(MANPREFIX)/man8/$(BIN).8
dist: clean
- _AT_echo creating dist tarball
- _AT_mkdir -p sinit-$(VERSION)
- _AT_cp LICENSE Makefile README config.def.h config.mk sinit.8 sinit.c \
- sinit-$(VERSION)
- _AT_tar -cf sinit-$(VERSION).tar sinit-$(VERSION)
- _AT_gzip sinit-$(VERSION).tar
- _AT_rm -rf sinit-$(VERSION)
+ mkdir -p sinit-$(VERSION)
+ cp LICENSE Makefile README config.def.h config.mk sinit.8 sinit.c sinit-$(VERSION)
+ tar -cf sinit-$(VERSION).tar sinit-$(VERSION)
+ gzip sinit-$(VERSION).tar
+ rm -rf sinit-$(VERSION)
-install: all
- _AT_echo installing executable to $(DESTDIR)$(PREFIX)/bin
- _AT_mkdir -p $(DESTDIR)$(PREFIX)/bin
- _AT_cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
- _AT_chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
- _AT_echo installing manual page to $(DESTDIR)$(MANPREFIX)/man8
- _AT_mkdir -p $(DESTDIR)$(MANPREFIX)/man8
- _AT_sed "s/VERSION/$(VERSION)/g" < sinit.8 > $(DESTDIR)$(MANPREFIX)/man8/sinit.8
- _AT_chmod 644 $(DESTDIR)$(MANPREFIX)/man8/sinit.8
+clean:
+ rm -f $(BIN) $(OBJ) sinit-$(VERSION).tar.gz
-uninstall:
- _AT_echo removing executable from $(DESTDIR)$(PREFIX)/bin
- _AT_cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
- _AT_echo removing manual page from $(DESTDIR)$(MANPREFIX)/man8
- _AT_rm -f $(DESTDIR)$(MANPREFIX)/man8/sinit.8
+.SUFFIXES: .def.h
-clean:
- _AT_echo cleaning
- _AT_rm -f $(BIN) $(OBJ) sinit-$(VERSION).tar.gz
+.def.h.h:
+ cp $< $_AT_
+
+.PHONY:
+ all install uninstall dist clean
diff --git a/config.mk b/config.mk
index 3b5a6e4..6d59696 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -8,5 +8,5 @@ MANPREFIX = $(PREFIX)/share/man
CC = cc
LD = $(CC)
CPPFLAGS =
-CFLAGS = -Wextra -Wall -Os $(CPPFLAGS)
+CFLAGS = -Wextra -Wall -Os
LDFLAGS = -s -static
Received on Thu Dec 04 2014 - 15:21:02 CET
This archive was generated by hypermail 2.3.0
: Thu Dec 04 2014 - 15:24:09 CET