pinosaur
/
smdp.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refined man-page
[smdp.git]
/
Makefile
diff --git
a/Makefile
b/Makefile
index
46ed432
..
c2a4898
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-1,6
+1,6
@@
#
# Makefile
#
# Makefile
-# Copyright (C) 201
4
Michael Goehler
+# Copyright (C) 201
5
Michael Goehler
#
# This file is part of mdp.
#
#
# This file is part of mdp.
#
@@
-18,40
+18,52
@@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-CFLAGS = -O3 -Wall
+UNAME_S := $(shell uname -s 2>/dev/null || echo not)
-ifeq ($(DEBUG),1)
-CFLAGS := -O0 -Wall -g
-LDFLAGS :=
+SOURCES = $(wildcard src/*.c)
+OBJECTS = $(SOURCES:.c=.o)
+TARGET = mdp
+DESTDIR =
+PREFIX = /usr/local
+
+CURSES = ncursesw
+LDFLAGS ?= -s
+
+ifeq (Windows_NT,$(OS))
+ ifeq (,$(findstring CYGWIN,$(UNAME_S)))
+ CURSES := pdcurses
+ endif
endif
endif
-OSTYPE := $(shell uname -o)
-CURSES = ncursesw
-ifeq (Windows_NT, $(OS))
-ifneq (Cygwin, $(OSTYPE))
-CURSES := pdcurses
-CFLAGS += -DWIN32=1
+ifeq ($(UNAME_S),Darwin)
+ CURSES := ncurses
+ LDFLAGS :=
endif
endif
+
+ifeq ($(DEBUG),1)
+ LDFLAGS :=
endif
endif
-LDFLAGS = -s
LDLIBS = -l$(CURSES)
LDLIBS = -l$(CURSES)
-OBJECTS = cstring.o cstack.o markdown.o parser.o viewer.o mdp.o
-DESTDIR = /usr/bin
-all: mdp
+all: $(TARGET)
+
+$(TARGET): src
+ $(CC) $(OBJECTS) $(LDLIBS) $(LDFLAGS) -o $(TARGET)
-mdp: $(OBJECTS)
+src:
+ $(MAKE) $(MFLAGS) -C src
clean:
clean:
- $(RM) $(OBJECTS) mdp
+ $(MAKE) -C src clean
+ $(RM) $(TARGET)
-install: mdp
- install -d $(PREFIX)$(DESTDIR)
- install -m 755 mdp $(PREFIX)$(DESTDIR)/mdp
+install:
+ install -d $(DESTDIR)$(PREFIX)/bin
+ install -m 755 mdp $(DESTDIR)$(PREFIX)/bin/$(TARGET)
+ install -m 644 mdp.1 $(DESTDIR)$(PREFIX)/share/man/man1/
uninstall:
uninstall:
- $(RM) $(PREFIX)$(DESTDIR)/mdp
-
-.PHONY: all clean install uninstall
+ $(RM) $(DESTDIR)$(PREFIX)/$(TARGET)
+.PHONY: all clean install src uninstall