Skip to content

Commit

Permalink
Improve Makefile
Browse files Browse the repository at this point in the history
 - Installation directory overridable via PREFIX arg, e.g. `make
   PREFIX=/somewhere install`

 - `compile` target removed in preference of real dependencies,
   i.e. `realpath` file depends on `realpath.c`

 - `install` target added to `.PHONY`
  • Loading branch information
harto committed Sep 24, 2015
1 parent 14f9f70 commit 4b6f391
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
BIN=realpath
compile:
gcc -Wall -o ${BIN} ${BIN}.c
install:
cp -f ${BIN} /usr/bin/${BIN}
PREFIX=/usr/local/bin
PROG=realpath

.PHONY: install

${PROG}: ${PROG}.c
gcc -Wall -o $@ $^

install:
cp -f ${PROG} ${PREFIX}/${PROG}

0 comments on commit 4b6f391

Please sign in to comment.