From bcb1b30a64dea0daf4381c2af9e4f972951b7ec4 Mon Sep 17 00:00:00 2001 From: boyska Date: Fri, 30 Jan 2015 16:28:06 +0100 Subject: [PATCH] make install --- Makefile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ce60071..e19ef62 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,20 @@ images_names=kodim01.png kodim02.png -all: split -images:$(addprefix testImage/,$(images_names)) -.PHONY: clean test - -BINS=split tests/createBlankImage +PREFIX ?= /usr/local +PROG=split +BINS=${PROG} tests/createBlankImage OBJ:=split.o lib/fillwithblack.o lib/manppm.o EXTRACFLAGS= CFLAGS=-Wall $(EXTRACFLAGS) +all: ${PROG} +images:$(addprefix testImage/,$(images_names)) +.PHONY: clean test + $(BINS): $(CC) $(CFLAGS) -lm -o $@ $^ -split: $(OBJ) +${PROG}: $(OBJ) tests/createBlankImage: tests/createBlankImage.o lib/fillwithblack.o lib/manppm.o @@ -20,9 +22,10 @@ testImage/kodim%.png: wget --quiet http://r0k.us/graphics/kodak/kodak/$(notdir $@) -O $@ clean: - rm -f $(OBJ) split tests/createBlankImage - + rm -f $(OBJ) ${PROG} tests/createBlankImage - -test: tests/cuttest tests/createBlankImage split +test: tests/cuttest tests/createBlankImage ${PROG} cd $(dir $<) && bash $(notdir $<) + +install: + @install -Dm755 ${PROG} ${DESTDIR}/${PREFIX}/bin/${PROG}