myadm

Simple MySQL client for the terminal
git clone git://git.bitsmanent.org/myadm
Log | Files | Refs | README | LICENSE

Makefile (1833B)


      1 # myadm - mysql admin
      2 # See LICENSE file for copyright and license details.
      3 
      4 include config.mk
      5 
      6 APPNAME=myadm
      7 SRC = ${APPNAME}.c
      8 OBJ = ${SRC:.c=.o}
      9 
     10 all: options ${APPNAME}
     11 
     12 options:
     13 	@echo ${APPNAME} build options:
     14 	@echo "CFLAGS   = ${CFLAGS}"
     15 	@echo "LDFLAGS  = ${LDFLAGS}"
     16 	@echo "CC       = ${CC}"
     17 
     18 .c.o:
     19 	@echo CC $<
     20 	@${CC} -c ${CFLAGS} $<
     21 
     22 ${OBJ}: config.h config.mk stflfrag fragments.h
     23 
     24 config.h:
     25 	@echo creating $@ from config.def.h
     26 	@cp config.def.h $@
     27 
     28 fragments.h:
     29 	@echo creating $@
     30 	@echo \#define FRAG_ITEMS L\"`./stflfrag items.stfl |sed 's/"/\\\"/g'`\" > $@
     31 
     32 ${APPNAME}: ${OBJ}
     33 	@echo CC -o $@
     34 	@${CC} -o $@ ${OBJ} ${LDFLAGS}
     35 
     36 clean:
     37 	@echo cleaning
     38 	@rm -f ${APPNAME} ${OBJ} ${APPNAME}-${VERSION}.tar.gz
     39 	@rm -f stflfrag stflfrag.o fragments.h
     40 
     41 dist: clean
     42 	@echo creating dist tarball
     43 	@mkdir -p ${APPNAME}-${VERSION}
     44 	@cp -R LICENSE Makefile README config.mk \
     45 		${APPNAME}.1 ${SRC} ${APPNAME}-${VERSION}
     46 	@tar -cf ${APPNAME}-${VERSION}.tar ${APPNAME}-${VERSION}
     47 	@gzip ${APPNAME}-${VERSION}.tar
     48 	@rm -rf ${APPNAME}-${VERSION}
     49 
     50 install: all
     51 	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
     52 	@mkdir -p ${DESTDIR}${PREFIX}/bin
     53 	@cp -f ${APPNAME} ${DESTDIR}${PREFIX}/bin
     54 	@chmod 755 ${DESTDIR}${PREFIX}/bin/${APPNAME}
     55 	@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
     56 	@mkdir -p ${DESTDIR}${MANPREFIX}/man1
     57 	@sed "s/VERSION/${VERSION}/g" < ${APPNAME}.1 > ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1
     58 	@chmod 644 ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1
     59 
     60 stflfrag:
     61 	@echo CC -o $@
     62 	@${CC} -o $@ $@.c ${LDFLAGS}
     63 
     64 uninstall:
     65 	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
     66 	@rm -f ${DESTDIR}${PREFIX}/bin/${APPNAME}
     67 	@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
     68 	@rm -f ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1
     69 
     70 .PHONY: all stflfrag options clean dist install uninstall