-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
44 lines (34 loc) · 840 Bytes
/
makefile
File metadata and controls
44 lines (34 loc) · 840 Bytes
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
IFROOT=$(shell id -u)
BIN=BCDock
DESTDIR=/usr/local/bin
CC=gcc
CFLAGS=-c -Wall -std=gnu99 -O3
LDFLAGS=-lncurses
SOURCES=$(wildcard *.c)
OBJECTS=$(SOURCES:%.c=%.o)
all: $(OBJECTS) $(BIN)
$(OBJECTS): %.o : %.c
@echo "Creating objects ..."
$(CC) $(CFLAGS) $< -o $@
$(BIN): $(OBJECTS)
@echo "Creating binary ..."
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
install: all
ifeq ($(IFROOT),0)
@echo "Installing into ${DESTDIR}"
mkdir -p ${DESTDIR}
install -m 755 -t ${DESTDIR} ${BIN}
else
@echo "You have to be root in order to install the program!"
endif
uninstall:
ifeq ($(IFROOT),0)
@echo "Removing executable from ${DESTDIR}"
rm -f ${DESTDIR}/${BIN}
else
@echo "You have to be root in order to uninstall the program!"
endif
clean:
@echo "Cleaning objects and binary ..."
rm -f ${OBJECTS} ${BIN}
.PHONY: all install uninstall clean