-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (46 loc) · 1 KB
/
Makefile
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
49
50
51
52
53
54
55
56
57
#
# Alp Sayin
# 22.05.2012
#
#declare the source files
SOURCES= ax25.c \
devtag-allinone.c \
lock.c \
manchester.c \
printAsciiHex.c \
serial.c \
tun_alloc.c \
util.c \
datacollection.c \
tunclient.c
#use c compiler
CC=gcc
#compile only, show all warnings
CFLAGS=-c -Wall
#link the used libraries staticly
LDFLAGS=-static
#define sources
OBJECTS=$(SOURCES:.c=.o)
#name of the target executable
EXECUTABLE=radiotunnel
#install directory
INSTALL_DIR=/usr/bin
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
# rule to make a .o file from .c
# $< gives input file name
# $@ gives output file name
.c.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -rf $(OBJECTS) $(EXECUTABLE)
run: all
./$(EXECUTABLE)
# copy the executable to usr bin directory
# and set suid, so that when it runs it runs as root
install: all
cp $(EXECUTABLE) $(INSTALL_DIR)/$(EXECUTABLE)
# remove the executable from the usr bin directory
uninstall:
rm -rf $(INSTALL_DIR)/$(EXECUTABLE)