2009-05-21 16:10:38 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
cat << EOF > Makefile
|
|
|
|
# Default target
|
2009-06-07 01:25:24 +02:00
|
|
|
.DEFAULT_GOAL = all
|
2009-05-21 16:10:38 +02:00
|
|
|
|
|
|
|
SHELL = $SHELL
|
|
|
|
CC = $CC
|
|
|
|
BISON = $BISON
|
2009-06-06 13:40:55 +02:00
|
|
|
FLEX = $FLEX
|
2009-05-21 16:10:38 +02:00
|
|
|
RM = $RM
|
|
|
|
RMDIR = $RMDIR
|
|
|
|
TEST = $TEST
|
|
|
|
MAKE = $MAKE
|
|
|
|
GREP = $GREP
|
|
|
|
CUT = $CUT
|
|
|
|
SORT = $SORT
|
|
|
|
PR = $PR
|
2009-06-09 13:24:34 +02:00
|
|
|
CP = $CP
|
|
|
|
CHMOD = $CHMOD
|
2009-05-21 16:10:38 +02:00
|
|
|
|
|
|
|
CFLAGS = $CFLAGS
|
|
|
|
LDFLAGS = $LDFLAGS
|
|
|
|
LDLIBS = $LDLIBS
|
|
|
|
BFLAGS = $BFLAGS
|
2009-06-09 13:24:34 +02:00
|
|
|
FFLAGS = $FFLAGS
|
2009-05-21 16:10:38 +02:00
|
|
|
|
|
|
|
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)
|
2009-06-06 13:40:55 +02:00
|
|
|
ALL_FFLAGS = -t \$(FFLAGS)
|
2009-05-21 16:10:38 +02:00
|
|
|
|
|
|
|
VPATH = ./src
|
|
|
|
|
2009-06-09 13:24:34 +02:00
|
|
|
PROGRAMS = tok sen fla gph
|
2009-06-07 01:25:24 +02:00
|
|
|
|
2009-06-06 13:40:55 +02:00
|
|
|
TOK_OBJ_FILES = tok.o tok_cmdline.o
|
|
|
|
TOK_FLEX_FILES = tok.l
|
2009-06-07 01:25:24 +02:00
|
|
|
TOK_GGO_FILES = tok_cmdline.ggo
|
|
|
|
tok.o: tok_cmdline.h
|
|
|
|
|
2009-06-09 01:46:50 +02:00
|
|
|
SEN_OBJ_FILES = sen.o
|
|
|
|
SEN_FLEX_FILES = sen.l
|
|
|
|
|
2009-06-09 12:54:31 +02:00
|
|
|
FLA_OBJ_FILES = fla.o
|
|
|
|
|
2009-06-09 13:24:34 +02:00
|
|
|
GPH_PERL_FILES = gph.pl
|
|
|
|
|
2009-05-21 16:10:38 +02:00
|
|
|
CONFIG_FILES = src/config.h Makefile
|
|
|
|
|
|
|
|
.SUFFIXES:
|
|
|
|
.SUFFIXES: .l .y .h .c .o
|
|
|
|
|
2009-06-07 01:25:24 +02:00
|
|
|
.INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES))
|
|
|
|
.INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES))
|
|
|
|
.INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES))
|
2009-06-09 01:46:50 +02:00
|
|
|
.INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES))
|
|
|
|
|
2009-05-21 16:10:38 +02:00
|
|
|
.PHONY: all
|
|
|
|
all: \$(PROGRAMS)
|
2009-06-07 01:25:24 +02:00
|
|
|
|
2009-05-21 16:10:38 +02:00
|
|
|
|
|
|
|
.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)
|
2009-06-06 13:40:55 +02:00
|
|
|
\$(RM) \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES))
|
2009-06-07 01:25:24 +02:00
|
|
|
\$(RM) \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES))
|
|
|
|
\$(RM) \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES))
|
2009-06-09 01:46:50 +02:00
|
|
|
\$(RM) \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES))
|
2009-05-21 16:10:38 +02:00
|
|
|
|
|
|
|
.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)
|
|
|
|
|
2009-06-07 01:25:24 +02:00
|
|
|
%.c: %.l
|
2009-06-06 13:40:55 +02:00
|
|
|
\$(FLEX) -t \$< > \$@
|
|
|
|
|
2009-06-07 01:25:24 +02:00
|
|
|
%.c: %.ggo
|
2009-06-09 13:24:34 +02:00
|
|
|
gengetopt --input \$< --file-name \$(basename \$@) --conf-parser
|
2009-06-07 01:25:24 +02:00
|
|
|
|
|
|
|
%.h: %.ggo
|
2009-06-09 13:24:34 +02:00
|
|
|
gengetopt --input \$< --file-name \$(basename \$@) --conf-parser
|
2009-06-07 01:25:24 +02:00
|
|
|
|
2009-05-21 16:10:38 +02:00
|
|
|
%: %.o
|
|
|
|
\$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS)
|
|
|
|
|
2009-06-09 13:24:34 +02:00
|
|
|
%: %.pl
|
|
|
|
\$(CP) \$< \$@
|
|
|
|
\$(CHMOD) a+x \$@
|
|
|
|
|
2009-05-21 16:10:38 +02:00
|
|
|
tok: \$(TOK_OBJ_FILES)
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|