1 | #!/bin/sh |
---|
2 | |
---|
3 | cat << EOF > Makefile |
---|
4 | # Default target |
---|
5 | .DEFAULT_GOAL = all |
---|
6 | |
---|
7 | SHELL = $SHELL |
---|
8 | CC = $CC |
---|
9 | BISON = $BISON |
---|
10 | FLEX = $FLEX |
---|
11 | RM = $RM |
---|
12 | RMDIR = $RMDIR |
---|
13 | TEST = $TEST |
---|
14 | MAKE = $MAKE |
---|
15 | GREP = $GREP |
---|
16 | CUT = $CUT |
---|
17 | SORT = $SORT |
---|
18 | PR = $PR |
---|
19 | CP = $CP |
---|
20 | CHMOD = $CHMOD |
---|
21 | |
---|
22 | CFLAGS = $CFLAGS |
---|
23 | LDFLAGS = $LDFLAGS |
---|
24 | LDLIBS = $LDLIBS |
---|
25 | BFLAGS = $BFLAGS |
---|
26 | FFLAGS = $FFLAGS |
---|
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) |
---|
44 | ALL_FFLAGS = -t \$(FFLAGS) |
---|
45 | |
---|
46 | VPATH = ./src |
---|
47 | |
---|
48 | PROGRAMS = tok sen fla gph kot unfla grp mar ser kon rm12 |
---|
49 | |
---|
50 | TOK_OBJ_FILES = tok.o tok_cmdline.o |
---|
51 | TOK_FLEX_FILES = tok.l |
---|
52 | TOK_GGO_FILES = tok_cmdline.ggo |
---|
53 | tok: \$(TOK_OBJ_FILES) |
---|
54 | tok.o: tok.c |
---|
55 | tok.o: tok_cmdline.h |
---|
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 |
---|
60 | |
---|
61 | SEN_OBJ_FILES = sen.o |
---|
62 | SEN_FLEX_FILES = sen.l |
---|
63 | sen: \$(SEN_OBJ_FILES) |
---|
64 | sen.o: sen.c |
---|
65 | sen.c: sen.l |
---|
66 | |
---|
67 | FLA_OBJ_FILES = fla.o |
---|
68 | fla: \$(FLA_OBJ_FILES) |
---|
69 | fla.o: fla.c |
---|
70 | |
---|
71 | GPH_PERL_FILES = gph.pl |
---|
72 | gph: \$(GPH_PERL_FILES) |
---|
73 | |
---|
74 | KOT_PERL_FILES = kot.pl |
---|
75 | kot: \$(KOT_PERL_FILES) |
---|
76 | |
---|
77 | UNFLA_SH_FILES = unfla.sh |
---|
78 | unfla: \$(UNFLA_SH_FILES) |
---|
79 | |
---|
80 | GRP_PERL_FILES = grp.pl |
---|
81 | grp: \$(GRP_PERL_FILES) |
---|
82 | |
---|
83 | MAR_PERL_FILES = mar.pl |
---|
84 | mar: \$(MAR_PERL_FILES) |
---|
85 | |
---|
86 | SER_PERL_FILES = ser.pl |
---|
87 | ser: \$(SER_PERL_FILES) |
---|
88 | |
---|
89 | KON_PERL_FILES = kon.pl |
---|
90 | kon: \$(KON_PERL_FILES) |
---|
91 | |
---|
92 | RM12_SED_FILES = rm12.sed |
---|
93 | rm12: \$(RM12_SED_FILES) |
---|
94 | |
---|
95 | CONFIG_FILES = src/config.h Makefile |
---|
96 | |
---|
97 | .SUFFIXES: |
---|
98 | .SUFFIXES: .l .y .h .c .pl .o |
---|
99 | |
---|
100 | #.INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) |
---|
101 | #.INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) |
---|
102 | #.INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) |
---|
103 | #.INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) |
---|
104 | |
---|
105 | .PHONY: all |
---|
106 | all: \$(PROGRAMS) |
---|
107 | |
---|
108 | |
---|
109 | .PHONY: help |
---|
110 | help: |
---|
111 | @\$(MAKE) --print-data-base --question | \\ |
---|
112 | \$(GREP) '^[^.%][-A-Za-z0-9_]*:' | \\ |
---|
113 | \$(CUT) -f 1 -d : | \\ |
---|
114 | \$(GREP) -v '^Makefile$$' | \\ |
---|
115 | \$(SORT) | \\ |
---|
116 | \$(PR) --omit-pagination --width=80 --columns=4 |
---|
117 | |
---|
118 | |
---|
119 | .PHONY: clean |
---|
120 | clean: |
---|
121 | \$(RM) \$(PROGRAMS) |
---|
122 | \$(RM) \$(TOK_OBJ_FILES) |
---|
123 | \$(RM) \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) |
---|
124 | \$(RM) \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) |
---|
125 | \$(RM) \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) |
---|
126 | \$(RM) \$(SEN_OBJ_FILES) |
---|
127 | \$(RM) \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) |
---|
128 | \$(RM) \$(FLA_OBJ_FILES) |
---|
129 | |
---|
130 | .PHONY: distclean |
---|
131 | distclean: clean |
---|
132 | \$(RM) \$(CONFIG_FILES) |
---|
133 | |
---|
134 | .PHONY: install |
---|
135 | install: all |
---|
136 | echo TODO: make install |
---|
137 | |
---|
138 | .PHONY: uninstall |
---|
139 | uninstall: |
---|
140 | echo TODO: make uninstall |
---|
141 | |
---|
142 | %.o: %.c |
---|
143 | \$(CC) -c \$< -o \$@ \$(ALL_CFLAGS) |
---|
144 | |
---|
145 | %.c: %.l |
---|
146 | \$(FLEX) -t \$< > \$@ |
---|
147 | |
---|
148 | %.c: %.ggo |
---|
149 | gengetopt --input \$< --file-name \$(basename \$@) --conf-parser |
---|
150 | |
---|
151 | %.h: %.ggo |
---|
152 | gengetopt --input \$< --file-name \$(basename \$@) --conf-parser |
---|
153 | |
---|
154 | %: %.o |
---|
155 | \$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS) |
---|
156 | |
---|
157 | %: %.pl |
---|
158 | \$(CP) \$< \$@ |
---|
159 | \$(CHMOD) a+x \$@ |
---|
160 | |
---|
161 | %: %.sh |
---|
162 | \$(CP) \$< \$@ |
---|
163 | \$(CHMOD) a+x \$@ |
---|
164 | |
---|
165 | %: %.sed |
---|
166 | \$(CP) \$< \$@ |
---|
167 | \$(CHMOD) a+x \$@ |
---|
168 | |
---|
169 | EOF |
---|
170 | |
---|