garten

annotate Makefile @ 18:5937504619f2

rename game.h -> modules.h; added some error handling; and more
author meillo@marmaro.de
date Wed, 23 Jul 2008 17:40:55 +0200
parents bbc214c6fa6f
children
rev   line source
meillo@5 1 # garten by meillo@marmaro.de
meillo@5 2
meillo@5 3
meillo@5 4 NAME=garten
meillo@5 5 # extracts VERSION from the sources
meillo@5 6 #VERSION=$(shell cat *.c | sed -n '/define VERSION/ s/.*"\([^"]*\)".*/\1/p' )
meillo@5 7 #NV=${NAME}-${VERSION}
meillo@5 8
meillo@5 9 #DOCS=LICENSE README ChangeLog TODO examples
meillo@5 10
meillo@5 11 # paths
meillo@5 12 #PREFIX = /usr
meillo@5 13 #BINDIR = ${PREFIX}/bin
meillo@5 14 #MANDIR = ${PREFIX}/share/man
meillo@5 15
meillo@5 16 # compile env
meillo@5 17 CC = gcc
meillo@5 18 LD = ${CC}
meillo@5 19 DEBUG = -g
meillo@5 20 CFLAGS = -Wall -c ${DEBUG}
meillo@10 21 LDFLAGS = -Wall ${DEBUG} -lsqlite3
meillo@5 22
meillo@5 23 # files
meillo@18 24 DEP = db.h
meillo@12 25 SRC = main.c clock.c environment.c weather.c growth.c db.c
meillo@12 26 OBJ = $(SRC:.c=.o)
meillo@5 27
meillo@5 28
meillo@10 29 .PHONY: all
meillo@5 30 all: options build
meillo@5 31
meillo@10 32 .PHONY: options
meillo@5 33 options:
meillo@5 34 @echo build options:
meillo@5 35 @echo "CC = ${CC}"
meillo@5 36 @echo "LD = ${LD}"
meillo@5 37 @echo "CFLAGS = ${CFLAGS}"
meillo@5 38 @echo "LDFLAGS = ${LDFLAGS}"
meillo@5 39 @echo
meillo@5 40
meillo@5 41
meillo@10 42 .PHONY: build
meillo@5 43 build: options ${NAME}
meillo@5 44
meillo@5 45
meillo@12 46 $(OBJ): $(SRC) $(DEP)
meillo@5 47
meillo@18 48 main.o: main.c $(DEP) modules.h
meillo@18 49
meillo@12 50 ${NAME}: $(DEP) $(OBJ)
meillo@12 51 gcc -o $(NAME) $(LDFLAGS) $(OBJ)
meillo@5 52
meillo@5 53
meillo@10 54 .PHONY: car
meillo@5 55 car: clean all
meillo@5 56
meillo@5 57
meillo@10 58 .PHONY: strip
meillo@5 59 strip: ${NAME}
meillo@5 60 @echo stripping
meillo@14 61 @strip $(NAME)
meillo@5 62
meillo@5 63
meillo@10 64 .PHONY: changelog
meillo@10 65 changelog:
meillo@10 66 @echo generating changelog from mercurial log
meillo@10 67 @hg log -v --style changelog > ChangeLog
meillo@10 68
meillo@10 69
meillo@10 70 .PHONY: clean
meillo@10 71 clean:
meillo@10 72 rm -f *.o
meillo@14 73 rm -f $(NAME)
meillo@10 74
meillo@10 75
meillo@5 76 #dist: build changelog
meillo@5 77 #@echo "generating tarball"
meillo@5 78 #@mkdir -p ${NV}
meillo@5 79 #@cp -rf ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV}
meillo@5 80 #@fakeroot tar -czhof ${NV}.tar.gz ${NV}
meillo@5 81 #@rm -rf ${NV}