-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (48 loc) · 1.37 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
# This file is part of setalias
# Copyright © M. Kristall
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
# Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of version 2 of the GNU General Public
# License with this program; if not, write to the Free Software Foundation, Inc
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CC=gcc
RM=rm -f
INSTALL=install
OPTIMIZE_FLAGS=-DNDEBUG -O3
DEBUG_FLAGS=-g3
WARNING_FLAGS=-Wall
DEFS=
CFLAGS=
EXE=setalias
EXEDBG=$(EXE)dbg
INSTALL_PATH=/usr/bin
ifdef ALIASFILE
DEFS+= -DALIASFILE=\"$(ALIASFILE)\"
endif
ifdef NEWALIASES
DEFS+= -DNEWALIASES=\"$(NEWALIASES)\"
endif
CFLAGS+= $(DEFS)
.PHONY: default
default: release
.PHONY: debug
debug:
$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(WARNING_FLAGS) setalias.c -o $(EXEDBG)
.PHONY: release
release:
$(CC) $(CFLAGS) $(OPTIMIZE_FLAGS) $(WARNING_FLAGS) setalias.c -o $(EXE)
.PHONY: clean
clean:
$(RM) $(EXEDBG) $(EXE)
.PHONY: install
install:
$(RM) $(INSTALL_PATH)/$(EXE)
$(INSTALL) -g root -o root -m 4755 -s $(EXE) $(INSTALL_PATH)