1 | # |
---|
2 | # |
---|
3 | # |
---|
4 | topsrcdir = @top_srcdir@ |
---|
5 | srcdir = @srcdir@ |
---|
6 | prefix = @prefix@ |
---|
7 | exec_prefix = @exec_prefix@ |
---|
8 | libdir = @libdir@ |
---|
9 | includedir = @includedir@ |
---|
10 | # program executable goes here |
---|
11 | bindir = @bindir@ |
---|
12 | install_bindir = @bindir@ |
---|
13 | # Singular libs go here |
---|
14 | includedir = @includedir@ |
---|
15 | MOD_DEST = ./include |
---|
16 | INC_SRC = $(topsrcdir)/Singular |
---|
17 | |
---|
18 | ## |
---|
19 | ## various programs |
---|
20 | ## |
---|
21 | @SET_MAKE@ |
---|
22 | CC = @CC@ |
---|
23 | LD = @LD@ |
---|
24 | CXX = @CXX@ |
---|
25 | LEX = sh ../../Singular/flexer.sh |
---|
26 | PERL = @PERL@ |
---|
27 | BISON = bison |
---|
28 | |
---|
29 | SINGUNAME = @SINGUNAME@ |
---|
30 | SING_UNAME = @SING_UNAME@ |
---|
31 | SINGULAR_VERSION = @SINGULAR_VERSION@ |
---|
32 | S_VERSION = $${SINGULAR_VERSION-@SINGULAR_VERSION@} |
---|
33 | DISTROOT_NAME = Singular-${S_VERSION} |
---|
34 | BINDIST_NAME = ${DISTROOT_NAME}-${SINGUNAME} |
---|
35 | SHAREDIST_NAME = ${DISTROOT_NAME}-share |
---|
36 | MKINSTALLDIRS = ../mkinstalldirs |
---|
37 | LN_S = @LN_S@ |
---|
38 | INSTALL = $(INSTALL_SH) |
---|
39 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
---|
40 | INSTALL_DATA = @INSTALL_DATA@ |
---|
41 | INSTALL_SH = $(topsrcdir)/@ac_install_sh@ |
---|
42 | MODGEN = $(bindir)/modgen |
---|
43 | |
---|
44 | ## |
---|
45 | ## compiler and linker options |
---|
46 | ## |
---|
47 | CFLAGS += -fno-rtti -fno-exceptions -O3 -w -fomit-frame-pointer -pipe -fno-implicit-templates \ |
---|
48 | -g -I${includedir} -I../include -I${topsrcdir}/.. -DNDEBUG -DMODULE_GENERATOR \ |
---|
49 | -D${SING_UNAME} |
---|
50 | LIBS += -L/usr/local/lib |
---|
51 | |
---|
52 | OBJS = main.o mod_grammar.o scanner.o misc.o makefile.o utils.o \ |
---|
53 | creat_top.o proc.o proc_setup.o getopt.o getopt1.o |
---|
54 | |
---|
55 | ############################################################ |
---|
56 | ### |
---|
57 | ### |
---|
58 | ############################################################ |
---|
59 | all = modgen |
---|
60 | |
---|
61 | modgen: pathnames.h ${OBJS} modgen.h decl.inc typmap.h stype.h |
---|
62 | $(LD) -o $@ ${CFLAGS} ${OBJS} ${LIBS} |
---|
63 | |
---|
64 | install bindist: modgen |
---|
65 | ${MKINSTALLDIRS} ${bindir} |
---|
66 | ${INSTALL_PROGRAM} modgen ${bindir}/modgen-${SINGULAR_VERSION} |
---|
67 | rm -f ${bindir}/modgen |
---|
68 | cd ${bindir}; ${LN_S} modgen-${SINGULAR_VERSION} modgen |
---|
69 | |
---|
70 | install-bindist: modgen |
---|
71 | ${MKINSTALLDIRS} ${install_bindir} |
---|
72 | ${INSTALL_PROGRAM} modgen ${install_bindir}/modgen-${SINGULAR_VERSION} |
---|
73 | rm -f ${install_bindir}/modgen |
---|
74 | cd ${install_bindir}; ${LN_S} modgen-${SINGULAR_VERSION} modgen |
---|
75 | |
---|
76 | ############################################################ |
---|
77 | ### |
---|
78 | ### |
---|
79 | ############################################################ |
---|
80 | .SUFFIXES: .o .so .dll .lo .y |
---|
81 | |
---|
82 | .cc.o: |
---|
83 | $(CXX) -c ${CFLAGS} $< |
---|
84 | |
---|
85 | .c.o: |
---|
86 | $(CC) -c ${CFLAGS} $< |
---|
87 | |
---|
88 | .y.cc: |
---|
89 | @if test -r mod_grammar.cc; then \ |
---|
90 | touch mod_grammar.cc ;\ |
---|
91 | else \ |
---|
92 | if test "x${BISON}" = x; then \ |
---|
93 | echo Error: no bison given, could not rebuilt grammar.cc;\ |
---|
94 | exit 1; \ |
---|
95 | fi;\ |
---|
96 | ${BISON} -d -t -o mod_grammar.cc $<;\ |
---|
97 | ./mvbison;\ |
---|
98 | fi |
---|
99 | |
---|
100 | pathnames.h: |
---|
101 | echo "/*" > pathnames.h |
---|
102 | echo " *" >> pathnames.h |
---|
103 | echo " */" >> pathnames.h |
---|
104 | echo "" >> pathnames.h |
---|
105 | echo "#define TOPSRCDIR \"$(topsrcdir)\"" >> pathnames.h |
---|
106 | echo "#define SINGUNAME \"$(SINGUNAME)\"" >> pathnames.h |
---|
107 | |
---|
108 | scanner.cc: scanner.l mod_grammar.h modgen.h |
---|
109 | @if test -r scanner.cc; then \ |
---|
110 | touch scanner.cc ;\ |
---|
111 | else \ |
---|
112 | if test "x${LEX}" = x; then \ |
---|
113 | echo Error: no lex given, could not rebuilt scanner.cc;\ |
---|
114 | exit 1; \ |
---|
115 | fi;\ |
---|
116 | fi |
---|
117 | ${LEX} -s -I -t scanner.l > scanner.cc.lmp |
---|
118 | cp scanner.cc.lmp scanner.cc |
---|
119 | |
---|
120 | # $(LEX) -Pyymod scanner.l > scanner.cc |
---|
121 | |
---|
122 | ############################################################ |
---|
123 | ### |
---|
124 | ### |
---|
125 | ############################################################ |
---|
126 | clean: |
---|
127 | rm -f *.o core modgen |
---|
128 | rm -f decl.inc |
---|
129 | rm -f pathnames.h |
---|
130 | |
---|
131 | distclean: clean |
---|
132 | rm -f a.out *~ |
---|
133 | rm -f mod_grammar.cc mod_grammar.h decl.inc |
---|
134 | # rm -f Makefile |
---|
135 | |
---|
136 | |
---|
137 | # |
---|
138 | # |
---|
139 | # |
---|
140 | test: modgen |
---|
141 | rm -rf tmp |
---|
142 | mkdir tmp |
---|
143 | ./modgen ../kernel/kernel.mod |
---|
144 | |
---|
145 | # |
---|
146 | # |
---|
147 | # |
---|
148 | decl.inc: ../../Singular/grammar.h ../../Singular/tok.h |
---|
149 | -echo "/* declaration for modgen.cc */" > $@ |
---|
150 | -grep "^#define" ../../Singular/grammar.h | awk \ |
---|
151 | '{print "\tcase "$$2": strcpy(name,\""$$2"\"); break;"}' >> $@ |
---|
152 | -echo "" >> $@ |
---|
153 | -echo "/* declaration from tok.h */" >> $@ |
---|
154 | -grep "^ [A-Z_]*," ../../Singular/tok.h | sed "s/,//g" | awk \ |
---|
155 | '{print "\tcase "$$1": strcpy(name,\""$$1"\"); break;"}'>>$@ |
---|
156 | |
---|
157 | ############################################################ |
---|
158 | ### |
---|
159 | ### |
---|
160 | ############################################################ |
---|
161 | makefile.cc: pathnames.h |
---|
162 | misc.cc: modgen.h decl.inc |
---|
163 | utils.cc: modgen.h |
---|
164 | mod_grammar.cc: mod_grammar.y |
---|
165 | mod_grammar.h: mod_grammar.y |
---|