[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 | |
---|
[b5884b3] | 48 | PROGRAMS = tok sen fla gph kot unfla grp mar ser kon rm12 rs12 |
---|
[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 | |
---|
[ac9a049] | 80 | GRP_PERL_FILES = grp.pl |
---|
| 81 | grp: \$(GRP_PERL_FILES) |
---|
| 82 | |
---|
[dc21769] | 83 | MAR_PERL_FILES = mar.pl |
---|
| 84 | mar: \$(MAR_PERL_FILES) |
---|
| 85 | |
---|
[8c8a252] | 86 | SER_PERL_FILES = ser.pl |
---|
| 87 | ser: \$(SER_PERL_FILES) |
---|
| 88 | |
---|
[8e1730c] | 89 | KON_PERL_FILES = kon.pl |
---|
| 90 | kon: \$(KON_PERL_FILES) |
---|
| 91 | |
---|
[4518a0b] | 92 | RM12_SED_FILES = rm12.sed |
---|
| 93 | rm12: \$(RM12_SED_FILES) |
---|
| 94 | |
---|
[b5884b3] | 95 | RS12_OBJ_FILES = rs12.o |
---|
| 96 | rs12: \$(RS12_OBJ_FILES) |
---|
| 97 | rs12.o: rs12.c |
---|
| 98 | |
---|
[c08f3b1] | 99 | CONFIG_FILES = src/config.h Makefile |
---|
| 100 | |
---|
| 101 | .SUFFIXES: |
---|
[3a2ae91] | 102 | .SUFFIXES: .l .y .h .c .pl .o |
---|
[c08f3b1] | 103 | |
---|
[3a2ae91] | 104 | #.INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) |
---|
| 105 | #.INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) |
---|
| 106 | #.INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) |
---|
| 107 | #.INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) |
---|
[1e551bd] | 108 | |
---|
[c08f3b1] | 109 | .PHONY: all |
---|
| 110 | all: \$(PROGRAMS) |
---|
[12743b9] | 111 | |
---|
[c08f3b1] | 112 | |
---|
| 113 | .PHONY: help |
---|
| 114 | help: |
---|
| 115 | @\$(MAKE) --print-data-base --question | \\ |
---|
| 116 | \$(GREP) '^[^.%][-A-Za-z0-9_]*:' | \\ |
---|
| 117 | \$(CUT) -f 1 -d : | \\ |
---|
| 118 | \$(GREP) -v '^Makefile$$' | \\ |
---|
| 119 | \$(SORT) | \\ |
---|
| 120 | \$(PR) --omit-pagination --width=80 --columns=4 |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | .PHONY: clean |
---|
| 124 | clean: |
---|
| 125 | \$(RM) \$(PROGRAMS) |
---|
| 126 | \$(RM) \$(TOK_OBJ_FILES) |
---|
[44f59b8] | 127 | \$(RM) \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) |
---|
[12743b9] | 128 | \$(RM) \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) |
---|
| 129 | \$(RM) \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) |
---|
[3a2ae91] | 130 | \$(RM) \$(SEN_OBJ_FILES) |
---|
[1e551bd] | 131 | \$(RM) \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) |
---|
[3a2ae91] | 132 | \$(RM) \$(FLA_OBJ_FILES) |
---|
[b5884b3] | 133 | \$(RM) \$(RS12_OBJ_FILES) |
---|
[c08f3b1] | 134 | |
---|
| 135 | .PHONY: distclean |
---|
| 136 | distclean: clean |
---|
| 137 | \$(RM) \$(CONFIG_FILES) |
---|
| 138 | |
---|
| 139 | .PHONY: install |
---|
| 140 | install: all |
---|
| 141 | echo TODO: make install |
---|
| 142 | |
---|
| 143 | .PHONY: uninstall |
---|
| 144 | uninstall: |
---|
| 145 | echo TODO: make uninstall |
---|
| 146 | |
---|
| 147 | %.o: %.c |
---|
| 148 | \$(CC) -c \$< -o \$@ \$(ALL_CFLAGS) |
---|
| 149 | |
---|
[12743b9] | 150 | %.c: %.l |
---|
[44f59b8] | 151 | \$(FLEX) -t \$< > \$@ |
---|
| 152 | |
---|
[12743b9] | 153 | %.c: %.ggo |
---|
[e4cec26] | 154 | gengetopt --input \$< --file-name \$(basename \$@) --conf-parser |
---|
[12743b9] | 155 | |
---|
| 156 | %.h: %.ggo |
---|
[e4cec26] | 157 | gengetopt --input \$< --file-name \$(basename \$@) --conf-parser |
---|
[12743b9] | 158 | |
---|
[c08f3b1] | 159 | %: %.o |
---|
| 160 | \$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS) |
---|
| 161 | |
---|
[e4cec26] | 162 | %: %.pl |
---|
| 163 | \$(CP) \$< \$@ |
---|
| 164 | \$(CHMOD) a+x \$@ |
---|
| 165 | |
---|
[1e572e1] | 166 | %: %.sh |
---|
| 167 | \$(CP) \$< \$@ |
---|
| 168 | \$(CHMOD) a+x \$@ |
---|
| 169 | |
---|
[4518a0b] | 170 | %: %.sed |
---|
| 171 | \$(CP) \$< \$@ |
---|
| 172 | \$(CHMOD) a+x \$@ |
---|
| 173 | |
---|
[c08f3b1] | 174 | EOF |
---|
| 175 | |
---|