sinit

suckless init
git clone git://git.2f30.org/sinit
Log | Files | Refs | README | LICENSE

commit fd8710d8a5f90ea3677b2f9afe3138be94f7b38e
parent f8536ea0d905993652caf1950d6aae1fca881e0f
Author: sin <sin@2f30.org>
Date:   Thu,  4 Dec 2014 14:18:36 +0000

Simplify Makefile

Diffstat:
MMakefile | 77+++++++++++++++++++++++++++--------------------------------------------------
Mconfig.mk | 2+-
2 files changed, 28 insertions(+), 51 deletions(-)

diff --git a/Makefile b/Makefile @@ -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 $@ $(OBJ) $(LDLIBS) -all: options bin +sinit.o: config.h -options: - @echo sinit build options: - @echo "CFLAGS = $(CFLAGS)" - @echo "LDFLAGS = $(LDFLAGS)" - @echo "CC = $(CC)" - -bin: $(BIN) - -$(OBJ): config.h config.mk - -config.h: - @echo creating $@ from config.def.h - @cp config.def.h $@ - -.o: - @echo LD $@ - @$(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: - @echo CC $< - @$(CC) -c -o $@ $< $(CFLAGS) +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) + rm -f $(DESTDIR)$(MANPREFIX)/man8/$(BIN).8 dist: clean - @echo creating dist tarball - @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) + 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 - @echo installing executable to $(DESTDIR)$(PREFIX)/bin - @mkdir -p $(DESTDIR)$(PREFIX)/bin - @cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin - @chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN) - @echo installing manual page to $(DESTDIR)$(MANPREFIX)/man8 - @mkdir -p $(DESTDIR)$(MANPREFIX)/man8 - @sed "s/VERSION/$(VERSION)/g" < sinit.8 > $(DESTDIR)$(MANPREFIX)/man8/sinit.8 - @chmod 644 $(DESTDIR)$(MANPREFIX)/man8/sinit.8 +clean: + rm -f $(BIN) $(OBJ) sinit-$(VERSION).tar.gz -uninstall: - @echo removing executable from $(DESTDIR)$(PREFIX)/bin - @cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN) - @echo removing manual page from $(DESTDIR)$(MANPREFIX)/man8 - @rm -f $(DESTDIR)$(MANPREFIX)/man8/sinit.8 +.SUFFIXES: .def.h -clean: - @echo cleaning - @rm -f $(BIN) $(OBJ) sinit-$(VERSION).tar.gz +.def.h.h: + cp $< $@ + +.PHONY: + all install uninstall dist clean diff --git a/config.mk b/config.mk @@ -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