Compare commits

...

10 commits

6 changed files with 435 additions and 322 deletions

View file

@ -1,12 +1,17 @@
# libsmu - simple markup
# (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
OBJ = ${SRC:.c=.o}
all: options smu
all: smu
options:
@echo smu build options:
@ -14,42 +19,51 @@ options:
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
.c.o:
@echo CC $<
@${CC} -c ${CFLAGS} $<
smu: ${SRC}
@echo CC $@
@${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:
@echo cleaning
@rm -f smu ${OBJ} ${LIBOBJ} smu-${VERSION}.tar.gz
rm -f smu ${OBJ} ${LIBOBJ} smu-${VERSION}.tar.gz
dist: clean
@echo creating dist tarball
@mkdir -p smu-${VERSION}
@cp -R LICENSE Makefile config.mk smu.1 ${SRC} smu-${VERSION}
@tar -cf smu-${VERSION}.tar smu-${VERSION}
@gzip smu-${VERSION}.tar
@rm -rf smu-${VERSION}
mkdir -p smu-${VERSION}
cp -R LICENSE Makefile config.mk smu.1 ${SRC} smu-${VERSION}
tar -cf smu-${VERSION}.tar smu-${VERSION}
gzip smu-${VERSION}.tar
rm -rf smu-${VERSION}
install: all
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
@cp -f smu ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/smu
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
@sed "s/VERSION/${VERSION}/g" < smu.1 > ${DESTDIR}${MANPREFIX}/man1/smu.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/smu.1
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f smu ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/smu
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < smu.1 > ${DESTDIR}${MANPREFIX}/man1/smu.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/smu.1
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/smu
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/smu.1
rm -f ${DESTDIR}${PREFIX}/bin/smu
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
escapes all HTML Tags.
.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 */
void eprint(const char *format, ...);

View file

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