diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-03-27 11:54:22 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-03-27 11:54:22 +0100 |
commit | eaa925597d96f69141d42155928d649f4603bd07 (patch) | |
tree | f8d1e52dd49ac6b079d08d25b89a097d2df8b605 /Makefile | |
parent | 34cb42ec6c9e2bd4deb465509a58e7f8a9420f80 (diff) |
Support CFLAGS, PREFIX & LDFLAGS in Makefile; pretty make install output
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 39 |
1 files changed, 24 insertions, 15 deletions
@@ -1,26 +1,35 @@ -CFLAGS = -Wall -Wextra -pedantic -O2 -prefix = /usr/local +CFLAGS ?= -O2 +PREFIX ?= /usr/local + +CFLAGS += -Wall -Wextra -pedantic + +sysdir = ${DESTDIR}${PREFIX} all: bin/envstore bin/%: src/%.c - $(CC) $(CFLAGS) -o $@ $< + ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $< install: bin/envstore - mkdir -p $(prefix)/bin $(prefix)/share/man/man1 - cp bin/envstore $(prefix)/bin/envstore - cp bin/envify $(prefix)/bin/envify - cp man/1/envify $(prefix)/share/man/man1/envify.1 - cp man/1/envstore $(prefix)/share/man/man1/envstore.1 - chmod 755 $(prefix)/bin/envstore - chmod 755 $(prefix)/bin/envify - chmod 644 $(prefix)/share/man/man1/envify.1 - chmod 644 $(prefix)/share/man/man1/envstore.1 + @echo installing: + @echo 'envstore to ${sysdir}/bin' + @echo 'envify to ${sysdir}/bin' + @echo 'envstore.1 to ${sysdir}/share/man/man1' + @echo 'envify.1 to ${sysdir}/share/man/man1' + @mkdir -p ${sysdir}/bin ${sysdir}/share/man/man1 + @cp bin/envstore ${sysdir}/bin/envstore + @cp bin/envify ${sysdir}/bin/envify + @cp man/1/envify ${sysdir}/share/man/man1/envify.1 + @cp man/1/envstore ${sysdir}/share/man/man1/envstore.1 + @chmod 755 ${sysdir}/bin/envstore + @chmod 755 ${sysdir}/bin/envify + @chmod 644 ${sysdir}/share/man/man1/envify.1 + @chmod 644 ${sysdir}/share/man/man1/envstore.1 uninstall: - rm -f $(prefix)/bin/envstore $(prefix)/bin/envify - rm -f $(prefix)/share/man/man1/envify.1 - rm -f $(prefix)/share/man/man1/envstore.1 + rm -f ${sysdir}/bin/envstore ${sysdir}/bin/envify + rm -f ${sysdir}/share/man/man1/envify.1 + rm -f ${sysdir}/share/man/man1/envstore.1 test: test/main |