pinosaur
/
smdp.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #38 from FreeBirdLjj/issue#16
[smdp.git]
/
Makefile
diff --git
a/Makefile
b/Makefile
index
63a1feb
..
5801f84
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-18,29
+18,43
@@
# 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
+CURSES = ncursesw
+ifeq (Windows_NT, $(OS))
+OSTYPE := $(shell uname -o)
+ifneq (Cygwin, $(OSTYPE))
+CURSES := pdcurses
+endif
+endif
+
LDFLAGS = -s
LDFLAGS = -s
-LDLIBS = -lncurses
-OBJECTS = cstring.o cstack.o markdown.o parser.o viewer.o mdp.o
-DESTDIR ?= /usr/bin
+LDLIBS = -l$(CURSES)
+SOURCES = $(wildcard src/*.c)
+OBJECTS = $(SOURCES:.c=.o)
+TARGET = mdp
+DESTDIR = /usr/bin
ifeq ($(DEBUG),1)
ifeq ($(DEBUG),1)
-CFLAGS := -Wall -g -O0
LDFLAGS :=
endif
LDFLAGS :=
endif
-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 -Dm755 mdp $(PREFIX)$(DESTDIR)/mdp
+install:
+ install -d $(PREFIX)$(DESTDIR)
+ install -m 755 mdp $(PREFIX)$(DESTDIR)/$(TARGET)
uninstall:
uninstall:
- rm -f $(PREFIX)$(DESTDIR)/mdp
+ $(RM) $(PREFIX)$(DESTDIR)/$(TARGET)
-.PHONY: all clean install uninstall
+.PHONY: all clean install
src
uninstall