[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 | |
---|
[1e572e1] | 48 | PROGRAMS = tok sen fla gph kot unfla |
---|
[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 |
---|
[3a2ae91] | 53 | tok: \$(TOK_OBJ_FILES) |
---|
| 54 | tok.o: tok.c |
---|
[12743b9] | 55 | tok.o: tok_cmdline.h |
---|
[3a2ae91] | 56 | tok.c: tok.l |
---|
| 57 | tok_cmdline.o: tok_cmdline.c tok_cmdline.h |
---|
| 58 | tok_cmdline.c: tok_cmdline.ggo |
---|
| 59 | tok_cmdline.h: tok_cmdline.ggo |
---|
[12743b9] | 60 | |
---|
[1e551bd] | 61 | SEN_OBJ_FILES = sen.o |
---|
| 62 | SEN_FLEX_FILES = sen.l |
---|
[3a2ae91] | 63 | sen: \$(SEN_OBJ_FILES) |
---|
| 64 | sen.o: sen.c |
---|
| 65 | sen.c: sen.l |
---|
[1e551bd] | 66 | |
---|
[9e0afb5] | 67 | FLA_OBJ_FILES = fla.o |
---|
[3a2ae91] | 68 | fla: \$(FLA_OBJ_FILES) |
---|
| 69 | fla.o: fla.c |
---|
[9e0afb5] | 70 | |
---|
[e4cec26] | 71 | GPH_PERL_FILES = gph.pl |
---|
[3a2ae91] | 72 | gph: \$(GPH_PERL_FILES) |
---|
| 73 | |
---|
| 74 | KOT_PERL_FILES = kot.pl |
---|
| 75 | kot: \$(KOT_PERL_FILES) |
---|
[e4cec26] | 76 | |
---|
[1e572e1] | 77 | UNFLA_SH_FILES = unfla.sh |
---|
| 78 | unfla: \$(UNFLA_SH_FILES) |
---|
| 79 | |
---|
[c08f3b1] | 80 | CONFIG_FILES = src/config.h Makefile |
---|
| 81 | |
---|
| 82 | .SUFFIXES: |
---|
[3a2ae91] | 83 | .SUFFIXES: .l .y .h .c .pl .o |
---|
[c08f3b1] | 84 | |
---|
[3a2ae91] | 85 | #.INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) |
---|
| 86 | #.INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) |
---|
| 87 | #.INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) |
---|
| 88 | #.INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) |
---|
[1e551bd] | 89 | |
---|
[c08f3b1] | 90 | .PHONY: all |
---|
| 91 | all: \$(PROGRAMS) |
---|
[12743b9] | 92 | |
---|
[c08f3b1] | 93 | |
---|
| 94 | .PHONY: help |
---|
| 95 | help: |
---|
| 96 | @\$(MAKE) --print-data-base --question | \\ |
---|
| 97 | \$(GREP) '^[^.%][-A-Za-z0-9_]*:' | \\ |
---|
| 98 | \$(CUT) -f 1 -d : | \\ |
---|
| 99 | \$(GREP) -v '^Makefile$$' | \\ |
---|
| 100 | \$(SORT) | \\ |
---|
| 101 | \$(PR) --omit-pagination --width=80 --columns=4 |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | .PHONY: clean |
---|
| 105 | clean: |
---|
| 106 | \$(RM) \$(PROGRAMS) |
---|
| 107 | \$(RM) \$(TOK_OBJ_FILES) |
---|
[44f59b8] | 108 | \$(RM) \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) |
---|
[12743b9] | 109 | \$(RM) \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) |
---|
| 110 | \$(RM) \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) |
---|
[3a2ae91] | 111 | \$(RM) \$(SEN_OBJ_FILES) |
---|
[1e551bd] | 112 | \$(RM) \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) |
---|
[3a2ae91] | 113 | \$(RM) \$(FLA_OBJ_FILES) |
---|
[c08f3b1] | 114 | |
---|
| 115 | .PHONY: distclean |
---|
| 116 | distclean: clean |
---|
| 117 | \$(RM) \$(CONFIG_FILES) |
---|
| 118 | |
---|
| 119 | .PHONY: install |
---|
| 120 | install: all |
---|
| 121 | echo TODO: make install |
---|
| 122 | |
---|
| 123 | .PHONY: uninstall |
---|
| 124 | uninstall: |
---|
| 125 | echo TODO: make uninstall |
---|
| 126 | |
---|
| 127 | %.o: %.c |
---|
| 128 | \$(CC) -c \$< -o \$@ \$(ALL_CFLAGS) |
---|
| 129 | |
---|
[12743b9] | 130 | %.c: %.l |
---|
[44f59b8] | 131 | \$(FLEX) -t \$< > \$@ |
---|
| 132 | |
---|
[12743b9] | 133 | %.c: %.ggo |
---|
[e4cec26] | 134 | gengetopt --input \$< --file-name \$(basename \$@) --conf-parser |
---|
[12743b9] | 135 | |
---|
| 136 | %.h: %.ggo |
---|
[e4cec26] | 137 | gengetopt --input \$< --file-name \$(basename \$@) --conf-parser |
---|
[12743b9] | 138 | |
---|
[c08f3b1] | 139 | %: %.o |
---|
| 140 | \$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS) |
---|
| 141 | |
---|
[e4cec26] | 142 | %: %.pl |
---|
| 143 | \$(CP) \$< \$@ |
---|
| 144 | \$(CHMOD) a+x \$@ |
---|
| 145 | |
---|
[1e572e1] | 146 | %: %.sh |
---|
| 147 | \$(CP) \$< \$@ |
---|
| 148 | \$(CHMOD) a+x \$@ |
---|
| 149 | |
---|
[c08f3b1] | 150 | EOF |
---|
| 151 | |
---|