-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
101 lines (81 loc) · 2 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#
# Copyright (C) 2009 David Kelley
#
# This file is part of bviplus.
#
# Bviplus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Bviplus 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 the GNU General Public License
# along with bviplus. If not, see <http://www.gnu.org/licenses/>.
#
TARGET := bviplus
PREFIX ?= /usr/local
OBJS :=
OBJS += actions.o
OBJS += app_state.o
OBJS += creadline.o
OBJS += display.o
OBJS += help.o
OBJS += key_handler.o
OBJS += main.o
OBJS += search.o
OBJS += user_prefs.o
OBJS += vf_backend.o
OBJS += virt_file.o
LIBS :=
LIBS += ncurses
LIBS += panel
LIBS += pthread
INCLUDES :=
EXTRA_CFLAGS := -fgnu89-inline
PROFILE ?= 0
ifneq "$(PROFILE)" "0"
EXTRA_CFLAGS += -pg
endif
DEBUG ?= 0
ifeq "$(DEBUG)" "0"
EXTRA_CFLAGS += -O2
else
EXTRA_CFLAGS += -O0 -g
endif
EXTRA_CFLAGS += $(CFLAGS)
EXTRA_CFLAGS += -Wall -D_FILE_OFFSET_BITS=64
OBJDIR := objs
BUILD_OBJS := $(addprefix $(OBJDIR)/,$(OBJS))
# By default do a quiet build
ifeq "$(V)" "1"
QUIET :=
SHORT := @true
else
QUIET := @
SHORT := @echo
endif
MKDIR := mkdir -p
SILENT := @
.PHONY: all mkobjdir clean install
# Build all the prereqs and generate dependencies (-MMD)
$(OBJDIR)/%.o: %.c
$(SHORT) "CC $<"
$(QUIET)$(CC) $(EXTRA_CFLAGS) $(addprefix -I, $(INCLUDES)) -MMD -c $< -o $@
# Produce our binary
all: mkobjdir $(TARGET)
mkobjdir:
$(QUIET)$(MKDIR) $(OBJDIR)
$(TARGET): $(BUILD_OBJS)
$(SHORT) "LD $@"
$(QUIET)$(CC) $(EXTRA_CFLAGS) $^ $(addprefix -l,$(LIBS)) -o $@
clean:
rm -rf $(OBJDIR) $(TARGET)
distclean: clean
install: $(TARGET)
install -D $(TARGET) $(PREFIX)/bin/$(TARGET)
# Include dependencies
-include $(BUILD_OBJS:.o=.d)