[c08f3b1] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | cat << EOF > Makefile |
---|
| 4 | # Default target |
---|
[12743b9] | 5 | .DEFAULT_GOAL = all |
---|
[c08f3b1] | 6 | |
---|
| 7 | SHELL = $SHELL |
---|
| 8 | CC = $CC |
---|
| 9 | BISON = $BISON |
---|
[44f59b8] | 10 | FLEX = $FLEX |
---|
[c08f3b1] | 11 | RM = $RM |
---|
| 12 | RMDIR = $RMDIR |
---|
| 13 | TEST = $TEST |
---|
| 14 | MAKE = $MAKE |
---|
| 15 | GREP = $GREP |
---|
| 16 | CUT = $CUT |
---|
| 17 | SORT = $SORT |
---|
| 18 | PR = $PR |
---|
[e4cec26] | 19 | CP = $CP |
---|
| 20 | CHMOD = $CHMOD |
---|
[c08f3b1] | 21 | |
---|
| 22 | CFLAGS = $CFLAGS |
---|
| 23 | LDFLAGS = $LDFLAGS |
---|
| 24 | LDLIBS = $LDLIBS |
---|
| 25 | BFLAGS = $BFLAGS |
---|
[e4cec26] | 26 | FFLAGS = $FFLAGS |
---|
[c08f3b1] | 27 | |
---|
| 28 | DESTDIR = $DESTDIR |
---|
| 29 | |
---|
| 30 | prefix = $prefix |
---|
| 31 | exec_prefix = $exec_prefix |
---|
| 32 | bindir = $bindir |
---|
| 33 | sbindir = $sbindir |
---|
| 34 | datarootdir = $datarootdir |
---|
| 35 | datadir = $datadir |
---|
| 36 | sysconfdir = $sysconfdir |
---|
| 37 | sharedstatedir = $sharestatedir |
---|
| 38 | localstatedir = $localstatedir |
---|
| 39 | |
---|
| 40 | ALL_CFLAGS = \$(CFLAGS) |
---|
| 41 | ALL_LDFLAGS = \$(LDFLAGS) |
---|
| 42 | ALL_LDLIBS = \$(LDLIBS) |
---|
| 43 | ALL_BFLAGS = \$(BFLAGS) |
---|
[44f59b8] | 44 | ALL_FFLAGS = -t \$(FFLAGS) |
---|
[c08f3b1] | 45 | |
---|
| 46 | VPATH = ./src |
---|
| 47 | |
---|
[e4cec26] | 48 | PROGRAMS = tok sen fla gph |
---|
[12743b9] | 49 | |
---|
[44f59b8] | 50 | TOK_OBJ_FILES = tok.o tok_cmdline.o |
---|
| 51 | TOK_FLEX_FILES = tok.l |
---|
[12743b9] | 52 | TOK_GGO_FILES = tok_cmdline.ggo |
---|
| 53 | tok.o: tok_cmdline.h |
---|
| 54 | |
---|
[1e551bd] | 55 | SEN_OBJ_FILES = sen.o |
---|
| 56 | SEN_FLEX_FILES = sen.l |
---|
| 57 | |
---|
[9e0afb5] | 58 | FLA_OBJ_FILES = fla.o |
---|
| 59 | |
---|
[e4cec26] | 60 | GPH_PERL_FILES = gph.pl |
---|
| 61 | |
---|
[c08f3b1] | 62 | CONFIG_FILES = src/config.h Makefile |
---|
| 63 | |
---|
| 64 | .SUFFIXES: |
---|
| 65 | .SUFFIXES: .l .y .h .c .o |
---|
| 66 | |
---|
[12743b9] | 67 | .INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) |
---|
| 68 | .INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) |
---|
| 69 | .INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) |
---|
[1e551bd] | 70 | .INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) |
---|
| 71 | |
---|
[c08f3b1] | 72 | .PHONY: all |
---|
| 73 | all: \$(PROGRAMS) |
---|
[12743b9] | 74 | |
---|
[c08f3b1] | 75 | |
---|
| 76 | .PHONY: help |
---|
| 77 | help: |
---|
| 78 | @\$(MAKE) --print-data-base --question | \\ |
---|
| 79 | \$(GREP) '^[^.%][-A-Za-z0-9_]*:' | \\ |
---|
| 80 | \$(CUT) -f 1 -d : | \\ |
---|
| 81 | \$(GREP) -v '^Makefile$$' | \\ |
---|
| 82 | \$(SORT) | \\ |
---|
| 83 | \$(PR) --omit-pagination --width=80 --columns=4 |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | .PHONY: clean |
---|
| 87 | clean: |
---|
| 88 | \$(RM) \$(PROGRAMS) |
---|
| 89 | \$(RM) \$(TOK_OBJ_FILES) |
---|
[44f59b8] | 90 | \$(RM) \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) |
---|
[12743b9] | 91 | \$(RM) \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) |
---|
| 92 | \$(RM) \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) |
---|
[1e551bd] | 93 | \$(RM) \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) |
---|
[c08f3b1] | 94 | |
---|
| 95 | .PHONY: distclean |
---|
| 96 | distclean: clean |
---|
| 97 | \$(RM) \$(CONFIG_FILES) |
---|
| 98 | |
---|
| 99 | .PHONY: install |
---|
| 100 | install: all |
---|
| 101 | echo TODO: make install |
---|
| 102 | |
---|
| 103 | .PHONY: uninstall |
---|
| 104 | uninstall: |
---|
| 105 | echo TODO: make uninstall |
---|
| 106 | |
---|
| 107 | %.o: %.c |
---|
| 108 | \$(CC) -c \$< -o \$@ \$(ALL_CFLAGS) |
---|
| 109 | |
---|
[12743b9] | 110 | %.c: %.l |
---|
[44f59b8] | 111 | \$(FLEX) -t \$< > \$@ |
---|
| 112 | |
---|
[12743b9] | 113 | %.c: %.ggo |
---|
[e4cec26] | 114 | gengetopt --input \$< --file-name \$(basename \$@) --conf-parser |
---|
[12743b9] | 115 | |
---|
| 116 | %.h: %.ggo |
---|
[e4cec26] | 117 | gengetopt --input \$< --file-name \$(basename \$@) --conf-parser |
---|
[12743b9] | 118 | |
---|
[c08f3b1] | 119 | %: %.o |
---|
| 120 | \$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS) |
---|
| 121 | |
---|
[e4cec26] | 122 | %: %.pl |
---|
| 123 | \$(CP) \$< \$@ |
---|
| 124 | \$(CHMOD) a+x \$@ |
---|
| 125 | |
---|
[c08f3b1] | 126 | tok: \$(TOK_OBJ_FILES) |
---|
| 127 | |
---|
| 128 | EOF |
---|
| 129 | |
---|