Adding Makefile, changing to MIT/X License

This commit is contained in:
gottox@rootkit.lan 2007-12-10 12:43:27 +01:00
parent b65bc6d92b
commit c40dc50ec0
5 changed files with 117 additions and 19 deletions

21
LICENSE Normal file
View file

@ -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.

56
Makefile Normal file
View file

@ -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

20
cmarkdown.1 Normal file
View file

@ -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.

View file

@ -1,23 +1,7 @@
/* cmarkdown /* 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 * See LICENSE for further informations
* 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
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -315,7 +299,7 @@ main(int argc, char *argv[]) {
source = stdin; source = stdin;
if(argc > 1 && strcmp("-v", argv[1]) == 0) 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) else if(argc > 1 && strcmp("-h", argv[1]) == 0)
eprint("Usage %s [-n] [file]\n -n escape html strictly\n",argv[0]); eprint("Usage %s [-n] [file]\n -n escape html strictly\n",argv[0]);

17
config.mk Normal file
View file

@ -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