-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (47 loc) · 1.34 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
58
59
60
61
62
63
64
65
66
67
# Generic MinGW makefile (C source only)
# Modify variables/macros to fit your program
INSTALL_DIR=/usr/local
SBIN_DIR=$(INSTALL_DIR)/sbin
# make / make all | will compile your program.
# make clean | deletes all compiled object and executable files.
# make depend | rebuilds the dependancy list
# make run | compiles (if needed) and runs your program
# Compiler command
CC = gcc
# Linker command
LD = gcc
# Flags to pass to the compiler - add "-g" to include debug information
CFLAGS = -Wall
# Flags to pass to the linker
LDFLAGS =
# Command used to delete files
RM = rm
# List your object files here
OBJS = port-open.o
# List your source files here
SRCS = port-open.c
# Define your compile target here.
PROG = port-open
# Compile everything.
all: $(PROG)
# Link the program
$(PROG): $(OBJS)
$(LD) $(LDFLAGS) $(OBJS) -s -o $(PROG)
# All .o files depend on their corresponding .c file
%.o: %.c
$(CC) $(CFLAGS) -c $<
install:
cp -a port-open $(SBIN_DIR)/
cd $(SBIN_DIR) && ln -fs port-open port-close
cd $(SBIN_DIR) && ln -fs port-open ip-allow
cd $(SBIN_DIR) && ln -fs port-open ip-remove
cd $(SBIN_DIR) && ln -fs port-open ip-block
cd $(SBIN_DIR) && ln -fs port-open ip-unblock
clean:
$(RM) -f $(PROG)
$(RM) -f *.o port-close
distclean: clean
$(RM) -f depend
depend:
$(CC) $(CFLAGS) -MM $(SRCS) > depend
include depend