summaryrefslogtreecommitdiff
path: root/Makefile
blob: c0fb54c8fd6d3728a6e68f259be364456eb92d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.POSIX:
.SUFFIXES:

PREFIX = /usr/local
MANPREFIX = ${PREFIX}/man

CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -pedantic-errors
CFLAGS_DEBUG = -g3 -O0
LDLIBS = -lm -lncurses 

SRC = fun_menu.c cycle.c richwin.c stack.c utils.c
OBJ = ${SRC:.c=.o}
OBJ_DEBUG = ${SRC:.c=.odebug}

all: fun_menu

fun_menu: ${OBJ}
	${CC} ${LDFLAGS} -o $@ ${CFLAGS} ${OBJ} ${LDLIBS} 

debug: ${OBJ_DEBUG}
	${CC} ${LDFLAGS} -o fun_menu.debug ${CFLAGS} ${CFLAGS_DEBUG} ${OBJ_DEBUG} \
		${LDLIBS} 

.SUFFIXES: .c .o .odebug
.c.o:
	${CC} -c ${CFLAGS} $<
.c.odebug:
	${CC} -c -o ${<:.c=.odebug} ${CFLAGS} ${DEBUG} $<

deps:
	# TODO

install: all
	mkdir -p ${DESTDIR}${PREFIX}/bin
	cp -f fun_menu ${DESTDIR}${PREFIX}/bin
	chmod 755 ${DESTDIR}${PREFIX}/bin/fun_menu
	cp fun_menu.1 ${DESTDIR}${MANPREFIX}/man1
	mkdir -p ${DESTDIR}${MANPREFIX}/man1
	chmod 644 ${DESTDIR}${MANPREFIX}/man1/fun_menu.1.gz

uninstall: 
	rm -f ${DESTDIR}${PREFIX}/bin/fun_menu\
		${DESTDIR}${MANPREFIX}/man1/dwm.1

clean:
	rm -fr fun_menu fun_menu.debug ${OBJ} ${OBJ_DEBUG}

.PHONY: all install uninstall debug clean