commit c40dc50ec04d88624e1d57e52821b4dd22870dca
parent b65bc6d92bc260d97747d5423c2936f80bab1628
Author: gottox@rootkit.lan <gottox@rootkit.lan>
Date: Mon, 10 Dec 2007 12:43:27 +0100
Adding Makefile, changing to MIT/X License
Diffstat:
5 files changed, 117 insertions(+), 19 deletions(-)
diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,21 @@
+MIT/X Consortium License
+
+(c) 2007 Enno Boland <g s01 de>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/Makefile b/Makefile
@@ -0,0 +1,56 @@
+# cmarkup
+# (c) 2007 Enno Boland
+
+include config.mk
+
+SRC = cmarkdown.c
+OBJ = ${SRC:.c=.o}
+
+all: options cmarkdown
+
+options:
+ @echo cmarkdown build options:
+ @echo "CFLAGS = ${CFLAGS}"
+ @echo "LDFLAGS = ${LDFLAGS}"
+ @echo "CC = ${CC}"
+
+.c.o:
+ @echo CC $<
+ @${CC} -c ${CFLAGS} $<
+
+${OBJ}: config.mk
+
+cmarkdown: ${OBJ}
+ @echo CC -o $@
+ ${CC} -o $@ ${OBJ} ${LDFLAGS}
+
+clean:
+ @echo cleaning
+ @rm -f cmarkdown ${OBJ} cmarkdown-${VERSION}.tar.gz
+
+dist: clean
+ @echo creating dist tarball
+ @mkdir -p cmarkdown-${VERSION}
+ @cp -R LICENSE Makefile config.mk \
+ cmarkdown.1 ${SRC} cmarkdown-${VERSION}
+ @tar -cf cmarkdown-${VERSION}.tar cmarkdown-${VERSION}
+ @gzip cmarkdown-${VERSION}.tar
+ @rm -rf cmarkdown-${VERSION}
+
+install: all
+ @echo installing executable file to ${DESTDIR}${PREFIX}/bin
+ @mkdir -p ${DESTDIR}${PREFIX}/bin
+ @cp -f cmarkdown ${DESTDIR}${PREFIX}/bin
+ @chmod 755 ${DESTDIR}${PREFIX}/bin/cmarkdown
+ @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
+ @mkdir -p ${DESTDIR}${MANPREFIX}/man1
+ @sed "s/VERSION/${VERSION}/g" < cmarkdown.1 > ${DESTDIR}${MANPREFIX}/man1/cmarkdown.1
+ @chmod 644 ${DESTDIR}${MANPREFIX}/man1/cmarkdown.1
+
+uninstall:
+ @echo removing executable file from ${DESTDIR}${PREFIX}/bin
+ @rm -f ${DESTDIR}${PREFIX}/bin/cmarkdown
+ @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
+ @rm -f ${DESTDIR}${MANPREFIX}/man1/cmarkdown.1
+
+.PHONY: all options clean dist install uninstall
diff --git a/cmarkdown.1 b/cmarkdown.1
@@ -0,0 +1,20 @@
+.TH cmarkdown 1 cmarkdown\-VERSION
+.SH NAME
+cmarkdown \- Markdown interpreter in C
+.SH SYNOPSIS
+.B cmarkdown
+.RB [ \-v ]
+.SH DESCRIPTION
+cmarkdown is a simple interpreter for the markdown syntax.
+.SH OPTIONS
+.TP
+.B \-v
+prints version information to standard error, then exits.
+.TP
+.B \-h
+prints usage information to standard error, then exits.
+.TP
+.B \-n
+escape all html Tags.
+.SH BUGS
+Markdown maybe will never fully supported.
diff --git a/cmarkdown.c b/cmarkdown.c
@@ -1,23 +1,7 @@
/* cmarkdown
- * Copyright (C) <2007> Enno boland <g@s01.de>
+ * Copyright (C) <2007> Enno boland <g s01 de>
*
- * cmarkdown free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * To compile type
- * gcc -DVERSION=\"`date +%F`\" -o cmarkdown cmarkdown.c
+ * See LICENSE for further informations
*/
#include <stdlib.h>
@@ -315,7 +299,7 @@ main(int argc, char *argv[]) {
source = stdin;
if(argc > 1 && strcmp("-v", argv[1]) == 0)
- eprint("markdown in C "VERSION" (C) Enno Boland\n");
+ eprint("markdown in C %s (C) Enno Boland\n",VERSION);
else if(argc > 1 && strcmp("-h", argv[1]) == 0)
eprint("Usage %s [-n] [file]\n -n escape html strictly\n",argv[0]);
diff --git a/config.mk b/config.mk
@@ -0,0 +1,17 @@
+# cmarkdown version
+VERSION = 0.1
+
+# paths
+PREFIX = /usr/local
+MANPREFIX = ${PREFIX}/share/man
+
+# includes and libs
+INCS = -I. -I/usr/include
+LIBS = -L/usr/lib
+
+# flags
+CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
+LDFLAGS = -s ${LIBS}
+
+# compiler
+CC = cc