forked from sahib/rmlint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
86 lines (69 loc) · 1.56 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#source dir
SOURCEDIR=src
DOCDIR=doc
#MANDIR
MANDIR=$(DESTDIR)/usr/share/man/man1
#MANUAL
MANDOC=rmlint.1.gz
#install
INSTALLPATH=$(DESTDIR)/usr/bin
#Programs
ECHO=echo
RM=rm -rf
CAT=cat
CP=cp
STRIP=strip -s
MKDIR=mkdir -p
#compiling stuff
CC=gcc
#Heavy Warnlevel
WARN=-Wall -pedantic
OPTI=-march=native -O3 -s -finline-functions
ifdef DEBUG
CFLAGS=-c -pipe -ggdb3 $(WARN) -D_FILE_OFFSET_BITS=64
else
CFLAGS=-c -pipe $(OPTI) $(WARN) -D_FILE_OFFSET_BITS=64
endif
#Link flags
LDFLAGS=-lpthread -lm
SOURCES= \
$(SOURCEDIR)/md5.c \
$(SOURCEDIR)/useridcheck.c \
$(SOURCEDIR)/filter.c \
$(SOURCEDIR)/mode.c \
$(SOURCEDIR)/list.c \
$(SOURCEDIR)/rmlint.c \
$(SOURCEDIR)/main.c
OBJECTS=$(SOURCES:.c=.o)
INCLUDE=
EXECUTABLE=rmlint
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
@$(CC) $(OBJECTS) -o $@ $(LDFLAGS)
ifdef DEBUG
@$(ECHO) "=> Building debug target."
else
@$(STRIP) $(EXECUTABLE)
@$(ECHO) "=> Stripping program done."
endif
@$(ECHO) "=> Linking program done."
.c.o:
@$(ECHO) "-> Compiling $<"
@$(CC) $(INCLUDE) $(CFLAGS) $< -o $@
.PHONY : clean
clean:
@$(ECHO) "<> Making clean."
@$(RM) $(SOURCEDIR)/*.o $(EXECUTABLE) 2> /dev/null
.PHONY : install
install:
@$(MKDIR) $(INSTALLPATH)
@$(ECHO) "++ Copying executable to $(INSTALLPATH)"
@$(CP) $(EXECUTABLE) $(INSTALLPATH)
@$(MKDIR) $(MANDIR)
@$(ECHO) "++ Copying manpage to $(MANDIR)."
@$(CP) "$(DOCDIR)/$(MANDOC)" $(MANDIR)
.PHONY : uninstall
uninstall:
@$(ECHO) "-- Removing the lint of rmlint"
$(RM) "$(INSTALLPATH)/$(EXECUTABLE)"
$(RM) "$(MANDIR)/$(MANDOC)"