-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
58 lines (42 loc) · 1.36 KB
/
GNUmakefile
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
DESTDIR ?=
PREFIX ?= /usr
COMPRESS_MAN ?= yes
STRIP_BINARY ?= yes
EXAMPLES ?= yes
CSECFLAGS ?= -fstack-protector-all -Wall --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fstack-check -DPARANOID -std=gnu99
CFLAGS ?= -pipe -O2
CFLAGS += $(CSECFLAGS)
DEBUGCFLAGS ?= -pipe -Wall -Werror -ggdb3 -export-dynamic -Wno-error=unused-variable -O0 -pipe $(CSECFLAGS)
CARCHFLAGS ?= -march=native
LDSECFLAGS ?= -Xlinker -zrelro
LDFLAGS += $(LDSECFLAGS)
INSTDIR = $(DESTDIR)$(PREFIX)
objs=\
error.o\
malloc.o\
popen.o\
lrsync.o\
main.o\
binary=lrsync
all: $(objs)
$(CC) $(CARCHFLAGS) $(CFLAGS) $(LDFLAGS) $(objs) $(LIBS) -o $(binary)
%.o: %.c
$(CC) $(CARCHFLAGS) $(CFLAGS) $(INC) $< -c -o $@
debug:
$(CC) $(CARCHFLAGS) $(DEBUGCFLAGS) $(INC) $(LDFLAGS) *.c $(LIBS) -o $(binary)
clean:
rm -f $(binary) *.o
distclean: clean
install:
install -d "$(INSTDIR)/bin" "$(INSTDIR)/share/man/man1"
ifeq ($(STRIP_BINARY),yes)
strip --strip-unneeded -R .comment -R .GCC.command.line -R .note.gnu.gold-version $(binary)
endif
install -m 755 $(binary) "$(INSTDIR)"/bin/
install -m 644 man/man1/$(binary).1 "$(INSTDIR)"/share/man/man1/
ifeq ($(COMPRESS_MAN),yes)
rm -f "$(INSTDIR)"/share/man/man1/$(binary).1.gz
gzip "$(INSTDIR)"/share/man/man1/$(binary).1
endif
deinstall:
rm -f "$(INSTDIR)"/bin/$(binary) "$(INSTDIR)"/share/man/man1/$(binary).1.gz "$(INSTDIR)"/share/man/man1/$(binary).1