pinosaur
/
smdp.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
documented line by line support, closes #45, closes #75
[smdp.git]
/
Makefile
diff --git
a/Makefile
b/Makefile
index
46ed432
..
c1f8658
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-18,40
+18,51
@@
# 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)
uninstall:
uninstall:
- $(RM) $(PREFIX)$(DESTDIR)/mdp
-
-.PHONY: all clean install uninstall
+ $(RM) $(DESTDIR)$(PREFIX)/$(TARGET)
+.PHONY: all clean install src uninstall