94 lines
1.4 KiB
Makefile
94 lines
1.4 KiB
Makefile
|
#!/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
|
||
|
|