discordc

discordc - C Discord ping bot.
git clone git://git.beep.wimdupont.com/discordc.git
Log | Files | Refs | README | LICENSE

Makefile (927B)


      1 include config.mk
      2 
      3 BIN = discordc
      4 SRC = src/discordc.c src/discordapi.c src/discordjson.c src/timeutil.c
      5 OBJ = ${SRC:src/%.c=obj/%.o}
      6 DEP = ${OBJ:.o=.d}
      7 MAN1 = ${BIN:=.1}
      8 TARGET = bin/${BIN}
      9 
     10 all: ${TARGET}
     11 
     12 obj bin:
     13 	mkdir -p $@
     14 
     15 obj/%.o: src/%.c config.h | obj
     16 	$(CC) -g -MMD -MP -I. -c $(CFLAGS) -o $@ $<
     17 
     18 ${TARGET}: ${OBJ} | bin
     19 	${CC} -g -o $@ ${OBJ} ${LDFLAGS}
     20 
     21 config.h:
     22 	cp config.def.h $@
     23 
     24 clean:
     25 	rm -f ${TARGET} ${OBJ} ${DEP}
     26 	rm -f discordc *.o
     27 
     28 install: all
     29 	mkdir -p ${DESTDIR}${PREFIX}/bin
     30 	cp -f ${TARGET} "${DESTDIR}${PREFIX}/bin/${BIN}"
     31 	chmod 755 "${DESTDIR}${PREFIX}/bin/${BIN}"
     32 	mkdir -p "${DESTDIR}${MANPREFIX}/man1"
     33 	sed "s/VERSION/${VERSION}/g" < ${MAN1} > "${DESTDIR}${MANPREFIX}/man1/${MAN1}"
     34 	chmod 644 "${DESTDIR}${MANPREFIX}/man1/${MAN1}"
     35 
     36 uninstall:
     37 	rm -f \
     38 		"${DESTDIR}${PREFIX}/bin/${BIN}"\
     39 		"${DESTDIR}${MANPREFIX}/man1/${MAN1}"
     40 
     41 -include ${DEP}
     42 
     43 .PHONY: all clean install uninstall obj bin