summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-12-13 22:32:51 -0500
committerDave Reisner <dreisner@archlinux.org>2012-12-13 22:34:30 -0500
commit76548902ce2397f007235681c02c3bb4ce358aec (patch)
tree91cd76ee8a7ba59e5e87c6d003cfb40f2b1ee470
parent43909e6caefc4b4f4e872a4333c467651d645f45 (diff)
downloadexpac-76548902ce2397f007235681c02c3bb4ce358aec.tar.xz
cleanup makefile, ensure usage of implicit build rules
-rw-r--r--Makefile36
1 files changed, 13 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 424d3a9..af4947a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,43 +3,33 @@ VERSION = $(shell git describe --always)
# paths
PREFIX ?= /usr/local
-MANPREFIX ?= ${PREFIX}/share/man
+MANPREFIX ?= $(PREFIX)/share/man
# compiler flags
-CC ?= gcc
-CPPFLAGS += -DVERSION=\"${VERSION}\"
-CFLAGS += -std=c99 -g -pedantic -Wall -Wextra -Werror ${CPPFLAGS}
-LDFLAGS += -lalpm
-
-SRC = expac.c
-OBJ = ${SRC:.c=.o}
+CPPFLAGS := -DVERSION=\"$(VERSION)\" $(CPPFLAGS)
+CFLAGS := -std=c99 -g -pedantic -Wall -Wextra -Werror $(CFLAGS)
+LDLIBS = -lalpm
DISTFILES = expac.c README.pod
all: expac doc
-.c.o:
- ${CC} -c ${CFLAGS} $<
-
-expac: ${OBJ}
- ${CC} -o $@ ${OBJ} ${LDFLAGS}
-
doc: expac.1
expac.1: README.pod
- pod2man --section=1 --center="expac manual" --name="EXPAC" --release="expac ${VERSION}" $< > $@
+ pod2man --section=1 --center="expac manual" --name="EXPAC" --release="expac $(VERSION)" $< $@
install: expac
- install -D -m755 expac ${DESTDIR}${PREFIX}/bin/expac
- install -D -m644 expac.1 ${DESTDIR}${MANPREFIX}/man1/expac.1
+ install -D -m755 expac $(DESTDIR)$(PREFIX)/bin/expac
+ install -D -m644 expac.1 $(DESTDIR)$(MANPREFIX)/man1/expac.1
dist: clean
- mkdir expac-${VERSION}
- cp ${DISTFILES} expac-${VERSION}
- sed "s/^VERSION = .*/VERSION = ${VERSION}/" Makefile > expac-${VERSION}/Makefile
- tar cf - expac-${VERSION} | gzip -9 > expac-${VERSION}.tar.gz
- rm -rf expac-${VERSION}
+ mkdir expac-$(VERSION)
+ cp $(DISTFILES) expac-$(VERSION)
+ sed "s/^VERSION = .*/VERSION = $(VERSION)/" Makefile > expac-$(VERSION)/Makefile
+ tar cf - expac-$(VERSION) | gzip -9 > expac-$(VERSION).tar.gz
+ rm -rf expac-$(VERSION)
clean:
- ${RM} ${OBJ} expac expac.1
+ $(RM) expac.o expac expac.1
.PHONY: all clean dist doc install doc