view Makefile @ 9:a3547175f466

added license file
author meillo@marmaro.de
date Sat, 14 Jun 2008 18:07:51 +0200
parents aa24986b8969
children 61ca4934fb34
line wrap: on
line source

# by meillo@marmaro.de

NAME=resize-gd

# extracts VERSION from the sources
VERSION=$(shell cat *.c | sed -n '/define[ \t]*VERSION/ s/.*"\([^"]*\)".*/\1/p'  )
NV=${NAME}-${VERSION}

DOCS = 

# paths
PREFIX = /usr/local
BINDIR = ${PREFIX}/bin
MANDIR = ${PREFIX}/share/man

# compile env
CC = gcc
LD = ${CC}
DEBUG = -g
LIBS = -lgd
CFLAGS = -Wall -pedantic -c ${DEBUG}
LDFLAGS = -Wall -pedantic ${DEBUG} $(LIBS)

# files
SRC=resize-gd.c
OBJ=$(SRC:.c=.o)
DEP = 



.PHONY: all
all: options build


.PHONY: options
options:
	@echo build options:
	@echo "CC     = ${CC}"
	@echo "LD     = ${LD}"
	@echo "CFLAGS = ${CFLAGS}"
	@echo "LDFLAGS = ${LDFLAGS}"
	@echo


.PHONY: build
build: options ${NAME}


${NAME}: $(OBJ)
	$(CC) $(LDFLAGS) $(OBJ) -o $@


${OBJ}: ${DEP}


.PHONY: strip
strip: ${NAME}
	@echo stripping ${NAME}
	@strip ${NAME}


.PHONY: dist
dist: build changelog
	@echo "generating tarball"
	@mkdir -p ${NV}
	@cp -rf ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV}
	@tar -czf ${NV}.tar.gz ${NV}
	@rm -rf ${NV}


.PHONY: changelog
changelog:
	@echo generating changelog from mercurial log
	@hg log -v --style changelog > ChangeLog


.PHONY: install
install: build strip
	@echo installing executable file to ${DESTDIR}${BINDIR}
	@mkdir -p ${DESTDIR}${BINDIR}
	@cp ${NAME} ${DESTDIR}${BINDIR}
	@chmod 755 ${DESTDIR}${BINDIR}/${NAME}
	@echo installing manual page to ${DESTDIR}${MANDIR}/man1
	@mkdir -p ${DESTDIR}${MANDIR}/man1
	@cp ${NAME}.1 ${DESTDIR}${MANDIR}/man1/${NAME}.1
	@chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1


.PHONY: uninstall
uninstall:
	@echo removing executable file from ${DESTDIR}${BINDIR}
	@rm -f ${DESTDIR}${BINDIR}/${NAME}
	@echo removing manual page from ${DESTDIR}${MANDIR}/man1
	@rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1


.PHONY: clean
clean:
	rm -f *.o


.PHONY: realclean
realclean: clean
	rm -f ${NAME} ChangeLog