Compare commits

..

10 commits

6 changed files with 435 additions and 322 deletions

View file

@ -1,12 +1,17 @@
# libsmu - simple markup # libsmu - simple markup
# (c) 2007, 2008 Enno Boland # (c) 2007, 2008 Enno Boland
include config.mk VERSION = 1.5
PREFIX ?= /usr/local
MANPREFIX ?= ${PREFIX}/share/man
CFLAGS += -DVERSION=\"${VERSION}\"
PGO_GEN = ${CFLAGS} -fprofile-generate
PGO_USE = ${CFLAGS} -fprofile-use -fprofile-correction
LDFLAGS ?=
CC ?= cc
SRC = smu.c
SRC = smu.c all: smu
OBJ = ${SRC:.c=.o}
all: options smu
options: options:
@echo smu build options: @echo smu build options:
@ -14,42 +19,51 @@ options:
@echo "LDFLAGS = ${LDFLAGS}" @echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}" @echo "CC = ${CC}"
.c.o: smu: ${SRC}
@echo CC $< @echo CC $@
@${CC} -c ${CFLAGS} $< @${CC} -o $@ ${SRC} ${CFLAGS} ${LDFLAGS}
${OBJ}: config.mk pgo-build: ${SRC}
@echo CC smu
@${CC} -o smu ${SRC} ${PGO_GEN} ${LDFLAGS}
@echo Generating pgo data
@printf .
@./smu testdoc > /dev/null
@printf .
@cat testdoc | ./smu > /dev/null
@printf .
@./smu -n testdoc > /dev/null
@printf .
@cat testdoc | ./smu -n > /dev/null
@printf .
@rm smu
@printf '\n'
@echo Recompiling with pgo data
@echo CC smu
@${CC} -o smu ${SRC} ${PGO_USE} ${LDFLAGS}
@rm smu.gcda
smu: ${OBJ}
@echo LD $@
@${CC} -o $@ ${OBJ} ${LDFLAGS}
clean: clean:
@echo cleaning rm -f smu ${OBJ} ${LIBOBJ} smu-${VERSION}.tar.gz
@rm -f smu ${OBJ} ${LIBOBJ} smu-${VERSION}.tar.gz
dist: clean dist: clean
@echo creating dist tarball mkdir -p smu-${VERSION}
@mkdir -p smu-${VERSION} cp -R LICENSE Makefile config.mk smu.1 ${SRC} smu-${VERSION}
@cp -R LICENSE Makefile config.mk smu.1 ${SRC} smu-${VERSION} tar -cf smu-${VERSION}.tar smu-${VERSION}
@tar -cf smu-${VERSION}.tar smu-${VERSION} gzip smu-${VERSION}.tar
@gzip smu-${VERSION}.tar rm -rf smu-${VERSION}
@rm -rf smu-${VERSION}
install: all install: all
@echo installing executable file to ${DESTDIR}${PREFIX}/bin mkdir -p ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin cp -f smu ${DESTDIR}${PREFIX}/bin
@cp -f smu ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/smu
@chmod 755 ${DESTDIR}${PREFIX}/bin/smu mkdir -p ${DESTDIR}${MANPREFIX}/man1
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 sed "s/VERSION/${VERSION}/g" < smu.1 > ${DESTDIR}${MANPREFIX}/man1/smu.1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1 chmod 644 ${DESTDIR}${MANPREFIX}/man1/smu.1
@sed "s/VERSION/${VERSION}/g" < smu.1 > ${DESTDIR}${MANPREFIX}/man1/smu.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/smu.1
uninstall: uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin rm -f ${DESTDIR}${PREFIX}/bin/smu
@rm -f ${DESTDIR}${PREFIX}/bin/smu rm -f ${DESTDIR}${MANPREFIX}/man1/smu.1
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/smu.1
.PHONY: all options clean dist install uninstall .PHONY: all options clean dist install uninstall pgo-build

View file

@ -1,20 +0,0 @@
# smu version
VERSION = 1.5
# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
# includes and libs
INCS = -I. -I/usr/include
LIBS = -L/usr/lib
# flags
CFLAGS = -g -O0 -Wall -Werror -ansi ${INCS} -DVERSION=\"${VERSION}\"
#CFLAGS = -fprofile-arcs -ftest-coverage -pg -g -O0 -Wall -Werror -ansi ${INCS} -DVERSION=\"${VERSION}\"
#CFLAGS = -Os -Wall -Werror -ansi ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = -fprofile-arcs -ftest-coverage -pg ${LIBS}
LDFLAGS = ${LIBS}
# compiler
CC = cc

2
smu.1
View file

@ -20,4 +20,4 @@ prints usage information to standard error, then exits.
.B \-n .B \-n
escapes all HTML Tags. escapes all HTML Tags.
.SH BUGS .SH BUGS
Please report any Bugs to https://github.com/Gottox/smu/issues or via mail. Report any bugs to tenno+smu@suij.in

652
smu.c

File diff suppressed because it is too large Load diff

1
smu.h
View file

@ -16,4 +16,3 @@ int smu_convert(FILE *out, FILE *in, int suppresshtml);
/** utility */ /** utility */
void eprint(const char *format, ...); void eprint(const char *format, ...);

View file

@ -47,9 +47,11 @@ list in list:
entity: &, <, > entity: &, <, >
code: code:
```
int powerof2(unsigned int n) { int powerof2(unsigned int n) {
return !((n - 1) & n) && n > 0; return !((n - 1) & n) && n > 0;
} }
```
links links
----- -----