Commits

Jakub Wilk  committed e02fdca

Makefile: decruft.

  • Participants
  • Parent commits 8d2483a

Comments (0)

Files changed (1)

-DOCBOOK_XSL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
-VERSION=$(shell sed -n -e '/onk ([0-9]*[^0-9]*\([0-9.-]*\)).*/ { s//\1/; p; q; } ' < debian/changelog)
 CC = gcc
-CFLAGS = -std=gnu99 -pedantic -Wall -W -Os
-CFILES = $(wildcard *.c)
-OFILES = $(CFILES:.c=.o)
-EXEFILES = keyemit keysniff onk
+CFLAGS = -g -O2
+CFLAGS += -std=gnu99 -Wall -Wextra
 
+cfiles = $(wildcard *.c)
+ofiles = $(cfiles:.c=.o)
+exefiles = keyemit keysniff onk
+
+version = $(shell head -n1 doc/changelog | cut -d ' ' -f2 | tr -d '()')
+
+docbook_xsl = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
 xsltproc_opts = --param man.authors.section.enabled 0
 
 .PHONY: all
-all: $(EXEFILES)
+all: $(exefiles)
 
 .PHONY: clean
 clean:
-	$(RM) $(EXEFILES) *.o *.h doc/*.[0-9]
+	rm -f $(exefiles) *.o *.h doc/*.[0-9]
 
 .PHONY: doc
 doc: doc/keysniff.8 doc/keyemit.8 doc/onk.8
 
 %.8: %.xml
-	sed -e "s/\(<!ENTITY version '\).*\('>\)/\1$(VERSION)\2/" < $(<) \
-	| xsltproc $(xsltproc_opts) --path doc/ --xinclude --output $(@) $(DOCBOOK_XSL) -
+	sed -e "s/\(<!ENTITY version '\).*\('>\)/\1$(version)\2/" < $(<) \
+	| xsltproc $(xsltproc_opts) --path doc/ --xinclude --output $(@) $(docbook_xsl) -
 
 keylist.h: /usr/include/linux/input.h
-	./script/keylist.h.sh < ${<} > ${@}
+	./script/keylist.h.sh < $(<) > $(@)
 
 keytable.h: /usr/include/linux/input.h
-	./script/keytable.h.sh < ${<} > ${@}
+	./script/keytable.h.sh < $(<) > $(@)
 
-$(EXEFILES): %: %.o
-	$(CC) $(CFLAGS) -s ${<} -o ${@}
-
-$(OFILES): %.o: %.c
-	$(CC) $(CFLAGS) -c ${<} -o ${@}
+$(exefiles): %: %.o
+	$(LINK.c) $(<) -o $(@)
 
 include Makefile.dep