File: Makefile

package info (click to toggle)
mdp-src 1.0.18-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 292 kB
  • sloc: ansic: 2,012; makefile: 78
file content (76 lines) | stat: -rw-r--r-- 1,756 bytes parent folder | download
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
#
# Makefile
# Copyright (C) 2018 Michael Goehler
#
# This file is part of mdp.
#
# This program 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.
#
# 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 the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

UNAME_S := $(shell uname -s 2>/dev/null || echo not)

SOURCES = $(sort $(wildcard src/*.c))
OBJECTS = $(SOURCES:.c=.o)
TARGET  = mdp
DESTDIR =
PREFIX  ?= /usr/local
BINDIR  ?= ${PREFIX}/bin
MANDIR  ?= ${PREFIX}/share/man

CURSES  = ncursesw
LDFLAGS ?= -s
CFLAGS   ?= -O3
CFLAGS   += -Wall

ifeq (Windows_NT,$(OS))
	ifeq (,$(findstring CYGWIN,$(UNAME_S)))
		CURSES := pdcurses
	endif
endif

ifeq ($(UNAME_S),Darwin)
	CURSES := ncurses
	LDFLAGS :=
endif

ifeq ($(DEBUG),1)
	CFLAGS := -O0 -Wall -g
	LDFLAGS := 
endif

LDLIBS   = -l$(CURSES)

all: $(TARGET)

$(TARGET): src
	$(CC) $(OBJECTS) $(LDLIBS) $(CFLAGS) $(LDFLAGS) -o $(TARGET)

src:
	$(MAKE) $(MFLAGS) -C src

clean:
	$(MAKE) -C src clean
	$(RM) $(TARGET)

install:
	install -d $(DESTDIR)$(BINDIR)
	install -m 755 $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
	install -d $(DESTDIR)$(MANDIR)/man1
	install -m 644 mdp.1 $(DESTDIR)$(MANDIR)/man1/$(TARGET).1

uninstall:
	$(RM) $(DESTDIR)$(BINDIR)/$(TARGET)
	$(RM) $(DESTDIR)$(MANDIR)/man1/$(TARGET).1

.PHONY: all clean install src uninstall