diff options
author | KatolaZ <katolaz@freaknet.org> | 2020-01-04 01:47:18 +0000 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2020-01-04 01:47:18 +0000 |
commit | a0bed6034c4da3cba70fc2df3f6ef5204e10eea9 (patch) | |
tree | 54caab512e5eb4d1757820475bee9cabb051ccf1 | |
parent | d1d29f3306ef651796d171c8d406b14fc74778ca (diff) |
add Makefile and config.h
-rw-r--r-- | Makefile | 49 | ||||
-rw-r--r-- | config.h | 13 | ||||
-rw-r--r-- | config.mk | 6 |
3 files changed, 68 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e84eefd --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +# xml2tsv - simple xml-to-tsv converter +.POSIX: + +include config.mk + +SRC = xml.c xml2tsv.c +INC = config.h xml.h +OBJ = ${SRC:.c=.o} +DISTFILES = ${SRC} ${INC} Makefile config.mk + +all: options xml2tsv + +options: + @echo "-+- build options -+-" + @echo "PREFIX = ${PREFIX}" + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" + @echo "-+-+-+-+-+-+-+-+-+-+-" + +xml2tsv: ${OBJ} + +${OBJ}: ${INC} + +debug: clean + ${MAKE} CFLAGS="${DEBUG}" all + +clean: + @echo cleaning + @rm -f xml2tsv ${OBJ} + +install: all + @echo installing executable to ${DESTDIR}${BINDIR} + @mkdir -p "${DESTDIR}${BINDIR}" + @cp -f xml2tsv "${DESTDIR}${BINDIR}" + @chmod 755 "${DESTDIR}${BINDIR}/xml2tsv" + +uninstall: + @echo removing executable file from ${DESTDIR}${BINDIR} + @rm -f "${DESTDIR}${BINDIR}/xml2tsv" + +dist: clean + @echo "making a tarball" + @mkdir -p ./xml2tsv-${VERSION} + @rm -rf ./xml2tsv-${VERSION}/* + @cp -R ${DISTFILES} ./xml2tsv-${VERSION}/ + @tar -cf xml2tsv-${VERSION}.tar ./xml2tsv-${VERSION} + @gzip xml2tsv-${VERSION}.tar + @rm -rf xml2tsv-${VERSION} diff --git a/config.h b/config.h new file mode 100644 index 0000000..e34e9dd --- /dev/null +++ b/config.h @@ -0,0 +1,13 @@ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +/* maximum length of a tag -- unsigned int */ +#define STR_MAX 128 +/* maximum allowed tag depth -- unsigned int */ +#define DEPTH_MAX 50 +/* output field sepatator -- char */ +#define SEP '\t' +/* attribute assignment symbol -- char */ +#define SATTR '=' + +#endif diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..cec2305 --- /dev/null +++ b/config.mk @@ -0,0 +1,6 @@ +VERSION = 0.1 +PREFIX = /usr/local +BINDIR = ${PREFIX}/bin + +CFLAGS = -O3 -std=c99 + |