diff --git a/Makefile b/Makefile deleted file mode 100644 index f40d29b..0000000 --- a/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -# Default target -.DEFAULT: all - -# --- BEGIN CONFIGURATION --- - -PROJECT_NAME = utt -PROJECT_VERSION = 0.0.1 -PROJECT_PAGE = http://utt.wmi.amu.edu.pl -PROJECT_MAIL = utt@wmid.amu.edu.pl - -DESTDIR = - -prefix = /usr/local -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -sbindir = $(exec_prefix)/sbin -datarootdir = $(prefix)/share -datadir = $(datarootdir) -sysconfdir = $(prefix)/etc -sharedstatedir = $(prefix)/com -localstatedir = $(prefix)/var - -CFLAGS = -g -O2 -Wall -LDFLAGS = -LDLIBS = -BFLAGS = -d -FFLAGS = -8 -f - -ALL_CFLAGS = -DPROJECT_NAME="\"$(PROJECT_NAME)\"" \ - -DPROJECT_VERSION="\"$(PROJECT_VERSION)\"" \ - -DPROJECT_PAGE="\"$(PROJECT_PAGE)\"" \ - -DPROJECT_MAIL="\"$(PROJECT_MAIL)\"" \ - -DUTT_EXEC_PATH="\"$(bindir)\"" \ - $(CFLAGS) -ALL_LDFLAGS = $(LDFLAGS) -ALL_LDLIBS = $(LDLIBS) -ALL_BFLAGS = $(BFLAGS) -ALL_FFLAGS = $(FFLAGS) - - -# --- END CONFIGURATION --- - -.PHONY: all clean install uninstall - -all: - make -C app compile - -clean: - make -C app clean - -install: all - echo TODO: make install - -uninstall: - echo TODO: make uninstall diff --git a/auto/options b/auto/options new file mode 100755 index 0000000..5704f71 --- /dev/null +++ b/auto/options @@ -0,0 +1,140 @@ +#!/bin/sh + +help=no + +PROJECT_NAME='utt' +PROJECT_VERSION='0.0.1' +PROJECT_PAGE='http://utt.wmi.amu.edu.pl' +PROJECT_MAIL='utt@wmid.amu.edu.pl' + +SHELL='/bin/sh' +CC='/usr/bin/gcc' +BISON='/usr/bin/bison' +RM='/bin/rm -f' +RMDIR='/bin/rm -rf' +TEST='/usr/bin/test' +MAKE='/usr/bin/make' +GREP='/bin/grep' +CUT='/usr/bin/cut' +SORT='/usr/bin/sort' +PR='/usr/bin/pr' + +CFLAGS='-g -O2 -Wall' +LDFLAGS='' +LDLIBS='' +BFLAGS='' + +DESTDIR= + +prefix='/usr/local' +exec_prefix='$(prefix)' +bindir='$(exec_prefix)/bin' +sbindir='$(exec_prefix)/sbin' +datarootdir='$(prefix)/share' +datadir='$(datarootdir)' +sysconfdir='$(prefix)/etc' +sharedstatedir='$(prefix)/com' +localstatedir='$(prefix)/var' + +for option +do + case "$option" in + -*=*) value=$(echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//') ;; + *=*) value=$(echo "$option" | sed -e 's/[_A-Z0-9]*=//') ;; + *) value="" ;; + esac + + case "$option" in + --help) help=yes ;; + + --prefix=*) prefix="$value" ;; + --exec-prefix=*) exec_prefix="$value" ;; + --bindir=*) bindir="$value" ;; + --sbindir=*) sbindir="$value" ;; + --datarootdir=*) datarootdir="$value" ;; + --datadir=*) datadir="$value" ;; + --sysconfdir=*) sysconfdir="$value" ;; + --sharedstatedir=*) sharedstatedir="$value" ;; + --localstatedir=*) localstatedir="$value" ;; + + SHELL=*) SHELL="$value" ;; + CC=*) CC="$value" ;; + BISON=*) BISON="$value" ;; + RM=*) RM="$value" ;; + RMDIR=*) RMDIR="$value" ;; + TEST=*) TEST="$value" ;; + MAKE=*) MAKE="$value" ;; + GREP=*) GREP="$value" ;; + CUT=*) CUT="$value" ;; + SORT=*) SORT="$value" ;; + PR=*) PR="$value" ;; + + CFLAGS=*) CFLAGS="$value" ;; + LDFLAGS=*) LDFLAGS="$value" ;; + LDLIBS=*) LDLIBS="$value" ;; + BFLAGS=*) BFLAGS="$value" ;; + esac +done + +if [ "$help" = "yes" ]; then + +cat << HELP_END + +Configure script for $PROJECT_NAME $PROJECT_VERSION to adapt to many kinds of systems. + +Usage: + + ./configure [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Options: + + --help display this help and exit + +Installation directories: + + --prefix=PATH install architecture-independent files in PATH + --exec-prefix=PATH install architecture-dependent files in PATH + +Fine tuning of the installation directories: + + --bindir=PATH user executables + --sbindir=PATH system admin executables + --datarootdir=PATH read-only arch.-independent data root + --datadir=PATH read-only architecture-independent data + --sysconfdir=PATH read-only single-machine data + --sharedstatedir=PATH modifiable architecture-independent data + --localstatedir=PATH modifiable single-machine data + +Some influential environment variables: + + SHELL shell command + CC C compiler command + BISON Bison compiler command + RM rm command + RMDIR rmdir command + TEST test command + MAKE make command + GREP grep command + CUT cut command + SORT sort command + PR pr command + + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have + libraries in a nonstandard directory + LDLIBS libraries to pass to the linker, e.g. -l + BFLAGS Bison compiler flags + +Use these variables to override default values. + +Report bugs to <$PROJECT_MAIL>. +More details at $PROJECT_PAGE. + +HELP_END + + exit 1 +fi + diff --git a/auto/output/Makefile b/auto/output/Makefile new file mode 100755 index 0000000..a972d89 --- /dev/null +++ b/auto/output/Makefile @@ -0,0 +1,93 @@ +#!/bin/sh + +cat << EOF > Makefile +# Default target +.DEFAULT: all + +SHELL = $SHELL +CC = $CC +BISON = $BISON +RM = $RM +RMDIR = $RMDIR +TEST = $TEST +MAKE = $MAKE +GREP = $GREP +CUT = $CUT +SORT = $SORT +PR = $PR + +CFLAGS = $CFLAGS +LDFLAGS = $LDFLAGS +LDLIBS = $LDLIBS +BFLAGS = $BFLAGS + +DESTDIR = $DESTDIR + +prefix = $prefix +exec_prefix = $exec_prefix +bindir = $bindir +sbindir = $sbindir +datarootdir = $datarootdir +datadir = $datadir +sysconfdir = $sysconfdir +sharedstatedir = $sharestatedir +localstatedir = $localstatedir + +ALL_CFLAGS = \$(CFLAGS) +ALL_LDFLAGS = \$(LDFLAGS) +ALL_LDLIBS = \$(LDLIBS) +ALL_BFLAGS = \$(BFLAGS) +ALL_FFLAGS = \$(FFLAGS) + +VPATH = ./src + +PROGRAMS = tok +TOK_OBJ_FILES = tok.o +CONFIG_FILES = src/config.h Makefile + +.SUFFIXES: +.SUFFIXES: .l .y .h .c .o + +.PHONY: all +all: \$(PROGRAMS) + echo all + #make -C app compile + +.PHONY: help +help: + @\$(MAKE) --print-data-base --question | \\ + \$(GREP) '^[^.%][-A-Za-z0-9_]*:' | \\ + \$(CUT) -f 1 -d : | \\ + \$(GREP) -v '^Makefile$$' | \\ + \$(SORT) | \\ + \$(PR) --omit-pagination --width=80 --columns=4 + + +.PHONY: clean +clean: + \$(RM) \$(PROGRAMS) + \$(RM) \$(TOK_OBJ_FILES) + #make -C app clean + +.PHONY: distclean +distclean: clean + \$(RM) \$(CONFIG_FILES) + +.PHONY: install +install: all + echo TODO: make install + +.PHONY: uninstall +uninstall: + echo TODO: make uninstall + +%.o: %.c + \$(CC) -c \$< -o \$@ \$(ALL_CFLAGS) + +%: %.o + \$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS) + +tok: \$(TOK_OBJ_FILES) + +EOF + diff --git a/auto/output/config_h b/auto/output/config_h new file mode 100755 index 0000000..18125ad --- /dev/null +++ b/auto/output/config_h @@ -0,0 +1,14 @@ +#!/bin/sh + +cat << EOF > ./src/config.h +#ifndef CONFIG_H +#define CONFIG_H + +#define PROJECT_NAME "$PROJECT_NAME" +#define PROJECT_VERSION "$PROJECT_VERSION" +#define PROJECT_PAGE "$PROJECT_PAGE" +#define PROJECT_MAIL "$PROJECT_MAIL" + +#endif /* CONFIG_H */ +EOF + diff --git a/auto/summary b/auto/summary new file mode 100755 index 0000000..f17f8ae --- /dev/null +++ b/auto/summary @@ -0,0 +1,35 @@ +#!/bin/sh + +cat << SUMMARY_END + +Configuration summary + + prefix : $prefix + exec-prefix : $exec_prefix + bindir : $bindir + sbindir : $sbindir + datarootdir : $datarootdir + datadir : $datadir + sysconfdir : $sysconfdir + sharedstatedir : $sharedstatedir + localstatedir : $localstatedir + + SHELL : $SHELL + CC : $CC + BISON : $BISON + RM : $RM + RMDIR : $RMDIR + TEST : $TEST + MAKE : $MAKE + GREP : $GREP + CUT : $CUT + SORT : $SORT + PR : $PR + + CFLAGS : $CFLAGS + LDFLAGS : $LDFLAGS + LDLIBS : $LDLIBS + BFLAGS : $BFLAGS + +SUMMARY_END + diff --git a/configure b/configure new file mode 100755 index 0000000..921dbc7 --- /dev/null +++ b/configure @@ -0,0 +1,18 @@ +#!/bin/sh + +. ./auto/options + +if [ -f ./src/config.h ]; then + echo ERROR: config.h exists + exit +fi + +if [ -f ./Makefile ]; then + echo ERROR: Makefile exists + exit +fi + +. ./auto/output/config_h +. ./auto/output/Makefile + +. ./auto/summary