Merge pull request #6 from FreeBirdLjj/EnhancedMakefile
authorMichael Göhler <somebody.here@gmx.de>
Wed, 17 Sep 2014 17:33:41 +0000 (19:33 +0200)
committerMichael Göhler <somebody.here@gmx.de>
Wed, 17 Sep 2014 17:33:41 +0000 (19:33 +0200)
enhance makefile

Makefile
README.md

index d4df0d5..4360f37 100644 (file)
--- a/Makefile
+++ b/Makefile
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 #
 
-CC       = /usr/bin/gcc
-CFLAGS   = -Wall -g
-LDFLAGS  = -lncurses
+CFLAGS   = -O3
+LDFLAGS  = -s
+LDLIBS   = -lncurses
 OBJECTS  = cstring.o cstack.o markdown.o parser.o viewer.o mdp.o
 DESTDIR ?= /usr/bin
 
-%.o: %.c
-       $(CC) $(CFLAGS) -c $<
-
-mdp: $(OBJECTS)
-       $(CC) $(CFLAGS) -o mdp $(OBJECTS) $(LDFLAGS)
+ifeq ($(DEBUG),1)
+CFLAGS  := -Wall -g -O0
+LDFLAGS :=
+endif
 
 all: mdp
 
+mdp: $(OBJECTS)
+
 clean:
-       rm -f $(OBJECTS) mdp
+       $(RM) $(OBJECTS) mdp
 
 install: mdp
-       if which strip 1>/dev/null 2>&1; then strip mdp; fi
        install -d $(PREFIX)$(DESTDIR)
        install -m 755 mdp $(PREFIX)$(DESTDIR)/mdp
 
-.PHONY: clean install
+.PHONY: all clean install
 
index 8097bf4..8f58d78 100644 (file)
--- a/README.md
+++ b/README.md
@@ -56,3 +56,11 @@ _Review sample.md for more details._
 - 1-9 - go to slide n
 - q - exit
 
+
+---
+
+*How to debug it:*
+
+To make a debug version of `mdp`, just type:
+
+    $ make DEBUG=1