aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-11-06 13:17:38 +0100
committerKarel Kočí <cynerd@email.cz>2016-11-06 13:17:38 +0100
commit2f13e507c5069d0de3bd9fe65c1d48348d329fdd (patch)
tree81ad94f8da6f2fa1b651604b9123ef35f3bd0f2c
parentde427bb856c7d0a19bbed031cd8f7b36de9ed605 (diff)
downloadgeml-2f13e507c5069d0de3bd9fe65c1d48348d329fdd.tar.gz
geml-2f13e507c5069d0de3bd9fe65c1d48348d329fdd.tar.bz2
geml-2f13e507c5069d0de3bd9fe65c1d48348d329fdd.zip
Add CPREFIX configuration and fix external build
-rw-r--r--.gitignore8
-rw-r--r--Makefile15
-rwxr-xr-xconfigure15
3 files changed, 23 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index 05a7b15..4c3a22b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,10 +4,8 @@
build
geml
+html
-# Comment these for release. They are generated files using gperf and bison. For
-# final release they can be in repository. But during development ignore them.
-*.y.c
-*.y.h
-*.gperf.h
+# Comment these for release. They are generated files. For release they can be
+# in repository. But during development ignore them.
*.dot.png
diff --git a/Makefile b/Makefile
index 3a5f87e..ea16c12 100644
--- a/Makefile
+++ b/Makefile
@@ -19,11 +19,14 @@ endif
CFLAGS += -Wall
CFLAGS += -Iinclude -include $(O)/build/config.h
+# Apply CPREFIX
+CC:=$(CPREFIX)$(CC)
+
### Source files list ###########################
SRC = geml.c \
- utils.c \
- io.c \
- parser.c
+ args_parser.c \
+ io.c \
+ utils.c
### End of source files list ####################
CSRC = $(patsubst %,src/%,$(filter %.c,$(SRC)))
@@ -93,7 +96,7 @@ $(OBJ): $(O)/build/%.o: src/%.c $(O)/build/config.h
$(O)/build/config.h: $(O)/.config
@mkdir -p "$(@D)"
@echo " CONF $@"
- $(Q)./configure --op-h > $@
+ $(Q)$(O)/configure --op-h > $@
endif
## Configuation files ##
@@ -102,7 +105,7 @@ $(O)/.config:
$(O)/.config.mk: $(O)/.config
@echo " CONF $@"
- $(Q)./configure --op-makefile > $@
+ $(Q)$(O)/configure --op-makefile > $@
## Documentation targets ##
.PHONY: docs
@@ -118,7 +121,7 @@ serve-docs: docs/parser-states.dot.png
clean-docs:
@echo " CLEAN docs"
$(Q)$(RM) docs/parser-states.dot.png
- $(Q)$(RM) -r site
+ $(Q)$(RM) -r html
docs/%.dot.png: docs/%.dot
@echo " DOT $@"
diff --git a/configure b/configure
index 01778d0..3e5d58f 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#!/bin/sh
-# vim:ft=sh:ts=4:sw=4:expandtab
+# vim:ft=sh:ts=4:sw=4:noexpandtab
# Configured variables #####################################################
# Described in following format:
@@ -10,6 +10,7 @@ GEML_CONTACT:cynerd@email.cz:string:F:T
PREFIX:/usr/local:string:T:F
EPREFIX:/usr/local:string:T:F
DEBUG:no::T:F
+CPREFIX:::T:F
CC:cc::T:F
CFLAGS:::T:F
LFLAGS:::T:F
@@ -35,6 +36,7 @@ print_help() {
echo " In default PREFIX"
echo
echo "Environment variables:"
+ echo " CPREFIX Compilation tools prefix."
echo " CC C compiler command."
echo " CFLAGS C compiler flags."
echo " LDFLAGS C Linker flags."
@@ -49,7 +51,7 @@ CONFIG_FILE=.config
CONFIGURED_FILE=.configured # TODO
# Backup variables from environment
-ENVVARS="CC CFLAGS LDFLAGS DOT MKDOCS"
+ENVVARS="CPREFIX CC CFLAGS LDFLAGS DOT MKDOCS"
for E in $ENVVARS; do
eval "[ -n \"\${$E+y}\" ]" && eval "BACKUP_$E=\$$E"
done
@@ -76,8 +78,12 @@ while [ "$#" -gt 0 ]; do
print_help
exit 0
;;
+ --prefix)
+ PREFIX=$2
+ shift
+ ;;
--prefix=*)
- # TODO
+ PREFIX=${1#--prefix=}
;;
-d|--debug)
DEBUG=yes
@@ -141,6 +147,7 @@ doext() {
echo "# This is external configure script for GEML." > configure
echo "GEML_PATH=$GEMLDIR" >> configure
+ echo "cd \$(dirname \$0)" >> configure
echo "\$GEML_PATH/configure \$@" >> configure
chmod +x configure
@@ -154,7 +161,7 @@ makefile() {
fi
NAME=`echo "$L" | grep -o -E '^[^:]*'`
eval "VALUE=\$$NAME"
- echo "$NAME = $VALUE"
+ echo "$NAME := $VALUE"
done
}