2005-08-26 17:39:27 +00:00
|
|
|
# $Id: makefile 145 2001-10-17 21:53:10Z timo $
|
2005-10-05 03:13:20 +00:00
|
|
|
PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
|
2005-08-26 17:39:27 +00:00
|
|
|
TEMPDIR=/tmp
|
|
|
|
A=.a
|
|
|
|
O=.o
|
2005-10-04 19:15:34 +00:00
|
|
|
|
|
|
|
ifeq ($(PLATFORM),mingw32)
|
|
|
|
E=.exe
|
|
|
|
else
|
|
|
|
E=
|
|
|
|
endif
|
|
|
|
|
2005-10-04 01:49:02 +00:00
|
|
|
CC=gcc
|
2005-10-04 23:54:51 +00:00
|
|
|
LCC_CFLAGS=-O2 -Wall -fno-strict-aliasing
|
2005-08-26 17:39:27 +00:00
|
|
|
LDFLAGS=
|
2005-10-04 01:49:02 +00:00
|
|
|
LD=gcc
|
2005-10-26 22:52:17 +00:00
|
|
|
AR=ar
|
|
|
|
ARFLAGS=cru
|
2005-08-26 17:39:27 +00:00
|
|
|
RANLIB=ranlib
|
|
|
|
DIFF=diff
|
|
|
|
RM=rm -f
|
|
|
|
RMDIR=rmdir
|
2005-10-04 01:21:34 +00:00
|
|
|
BUILDDIR=build
|
2005-10-04 23:54:51 +00:00
|
|
|
BD=$(BUILDDIR)/
|
2005-10-29 22:05:20 +00:00
|
|
|
ifeq ($(PLATFORM),SunOS)
|
|
|
|
INSTALL=ginstall
|
|
|
|
else
|
|
|
|
INSTALL=install
|
|
|
|
endif
|
2005-08-26 17:39:27 +00:00
|
|
|
|
|
|
|
# $Id: makefile 145 2001-10-17 21:53:10Z timo $
|
|
|
|
|
|
|
|
what:
|
2005-08-28 12:35:05 +00:00
|
|
|
-@echo make all q3rcc lburg q3cpp q3lcc bprint liblcc triple clean clobber
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-04 01:21:34 +00:00
|
|
|
makedirs:
|
2005-10-05 21:07:47 +00:00
|
|
|
@if [ ! -d $(BD) ];then mkdir $(BD);fi
|
2005-10-04 01:21:34 +00:00
|
|
|
|
2005-08-28 12:35:05 +00:00
|
|
|
all:: q3rcc lburg q3cpp q3lcc bprint liblcc
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-04 23:54:51 +00:00
|
|
|
q3rcc: makedirs $(BD)q3rcc$(E)
|
|
|
|
lburg: makedirs $(BD)lburg$(E)
|
|
|
|
q3cpp: makedirs $(BD)q3cpp$(E)
|
|
|
|
q3lcc: makedirs $(BD)q3lcc$(E)
|
|
|
|
bprint: makedirs $(BD)bprint$(E)
|
|
|
|
liblcc: makedirs $(BD)liblcc$(A)
|
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
RCCOBJS=$(BD)alloc$(O) \
|
|
|
|
$(BD)bind$(O) \
|
|
|
|
$(BD)dag$(O) \
|
|
|
|
$(BD)dagcheck$(O) \
|
|
|
|
$(BD)decl$(O) \
|
|
|
|
$(BD)enode$(O) \
|
|
|
|
$(BD)error$(O) \
|
|
|
|
$(BD)expr$(O) \
|
|
|
|
$(BD)event$(O) \
|
|
|
|
$(BD)init$(O) \
|
|
|
|
$(BD)inits$(O) \
|
|
|
|
$(BD)input$(O) \
|
|
|
|
$(BD)lex$(O) \
|
|
|
|
$(BD)list$(O) \
|
|
|
|
$(BD)main$(O) \
|
|
|
|
$(BD)output$(O) \
|
|
|
|
$(BD)prof$(O) \
|
|
|
|
$(BD)profio$(O) \
|
|
|
|
$(BD)simp$(O) \
|
|
|
|
$(BD)stmt$(O) \
|
|
|
|
$(BD)string$(O) \
|
|
|
|
$(BD)sym$(O) \
|
|
|
|
$(BD)trace$(O) \
|
|
|
|
$(BD)tree$(O) \
|
|
|
|
$(BD)types$(O) \
|
|
|
|
$(BD)null$(O) \
|
|
|
|
$(BD)symbolic$(O) \
|
|
|
|
$(BD)gen$(O) \
|
|
|
|
$(BD)bytecode$(O)
|
|
|
|
|
|
|
|
$(BD)q3rcc$(E):: $(BD)main$(O) $(BD)librcc$(A) $(EXTRAOBJS)
|
|
|
|
$(LD) $(LDFLAGS) -o $@ $(BD)main$(O) $(EXTRAOBJS) $(BD)librcc$(A) $(EXTRALIBS)
|
2005-10-04 23:54:51 +00:00
|
|
|
|
|
|
|
$(BD)librcc$(A): $(RCCOBJS)
|
2005-10-26 22:52:17 +00:00
|
|
|
$(AR) $(ARFLAGS) $@ $(RCCOBJS); $(RANLIB) $@ || true
|
2005-08-26 17:39:27 +00:00
|
|
|
|
|
|
|
$(RCCOBJS): src/c.h src/token.h src/config.h
|
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)alloc$(O): src/alloc.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/alloc.c
|
|
|
|
$(BD)bind$(O): src/bind.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/bind.c
|
|
|
|
$(BD)dag$(O): src/dag.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/dag.c
|
|
|
|
$(BD)decl$(O): src/decl.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/decl.c
|
|
|
|
$(BD)enode$(O): src/enode.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/enode.c
|
|
|
|
$(BD)error$(O): src/error.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/error.c
|
|
|
|
$(BD)event$(O): src/event.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/event.c
|
|
|
|
$(BD)expr$(O): src/expr.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/expr.c
|
|
|
|
$(BD)gen$(O): src/gen.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/gen.c
|
|
|
|
$(BD)init$(O): src/init.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/init.c
|
|
|
|
$(BD)inits$(O): src/inits.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/inits.c
|
|
|
|
$(BD)input$(O): src/input.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/input.c
|
|
|
|
$(BD)lex$(O): src/lex.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/lex.c
|
|
|
|
$(BD)list$(O): src/list.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/list.c
|
|
|
|
$(BD)main$(O): src/main.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/main.c
|
|
|
|
$(BD)null$(O): src/null.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/null.c
|
|
|
|
$(BD)output$(O): src/output.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/output.c
|
|
|
|
$(BD)prof$(O): src/prof.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/prof.c
|
|
|
|
$(BD)profio$(O): src/profio.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/profio.c
|
|
|
|
$(BD)simp$(O): src/simp.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/simp.c
|
|
|
|
$(BD)stmt$(O): src/stmt.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/stmt.c
|
|
|
|
$(BD)string$(O): src/string.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/string.c
|
|
|
|
$(BD)sym$(O): src/sym.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/sym.c
|
|
|
|
$(BD)symbolic$(O): src/symbolic.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/symbolic.c
|
|
|
|
$(BD)bytecode$(O): src/bytecode.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/bytecode.c
|
|
|
|
$(BD)trace$(O): src/trace.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/trace.c
|
|
|
|
$(BD)tree$(O): src/tree.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/tree.c
|
|
|
|
$(BD)types$(O): src/types.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/types.c
|
|
|
|
$(BD)stab$(O): src/stab.c src/stab.h; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ src/stab.c
|
|
|
|
|
|
|
|
$(BD)dagcheck$(O): $(BD)dagcheck.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ $(BD)dagcheck.c
|
2005-10-04 23:54:51 +00:00
|
|
|
|
|
|
|
$(BD)dagcheck.c: $(BD)lburg$(E) src/dagcheck.md; $(BD)lburg src/dagcheck.md $@
|
|
|
|
|
|
|
|
$(BD)q3rcc.h: src/rcc.asdl; $(ASDL_HOME)/bin/asdlGen --c -d $(BD) src/rcc.asdl
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)q3rcc$(O): $(BD)rcc.h; $(CC) $(LCC_CFLAGS) -c -Isrc -I$(BD) -I$(ASDL_HOME)/include/asdlGen -o $@ $(BD)rcc.c
|
|
|
|
$(BD)asdl$(O): src/asdl.c $(BD)rcc.h src/c.h; $(CC) $(LCC_CFLAGS) -c -Isrc -I$(BD) -I$(ASDL_HOME)/include/asdlGen -o $@ src/asdl.c
|
|
|
|
$(BD)2html$(O): src/2html.c $(BD)rcc.h src/c.h; $(CC) $(LCC_CFLAGS) -c -Isrc -I$(BD) -I$(ASDL_HOME)/include/asdlGen -o $@ src/2html.c
|
2005-10-04 23:54:51 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)2html$(E): $(BD)2html$(O) $(BD)q3rcc$(O); $(LD) $(LDFLAGS) -o $@ $(BD)2html$(O) $(BD)q3rcc$(O) $(EXTRALIBS)
|
2005-10-04 23:54:51 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)bprint$(E): $(BD)bprint$(O); $(LD) $(LDFLAGS) -o $@ $(BD)bprint$(O)
|
2005-10-04 23:54:51 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)bprint$(O): etc/bprint.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ etc/bprint.c
|
2005-10-04 23:54:51 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)q3lcc$(E): $(BD)q3lcc$(O) $(BD)host$(O); $(LD) $(LDFLAGS) -o $@ $(BD)q3lcc$(O) $(BD)host$(O)
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)q3lcc$(O): etc/lcc.c; $(CC) $(LCC_CFLAGS) -c -DTEMPDIR=\"$(TEMPDIR)\" -o $@ etc/lcc.c
|
2005-11-01 22:09:15 +00:00
|
|
|
$(BD)host$(O): etc/bytecode.c; $(CC) $(LCC_CFLAGS) -c -DSYSTEM=\"\" -o $@ etc/bytecode.c
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
LIBOBJS=$(BD)assert$(O) $(BD)bbexit$(O) $(BD)yynull$(O)
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-26 22:52:17 +00:00
|
|
|
$(BD)liblcc$(A): $(LIBOBJS); $(AR) $(ARFLAGS) $@ $(BD)assert$(O) $(BD)bbexit$(O) $(BD)yynull$(O); $(RANLIB) $@ || true
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)assert$(O): lib/assert.c; $(CC) $(LCC_CFLAGS) -c -o $@ lib/assert.c
|
|
|
|
$(BD)yynull$(O): lib/yynull.c; $(CC) $(LCC_CFLAGS) -c -o $@ lib/yynull.c
|
|
|
|
$(BD)bbexit$(O): lib/bbexit.c; $(CC) $(LCC_CFLAGS) -c -o $@ lib/bbexit.c
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)lburg$(E): $(BD)lburg$(O) $(BD)gram$(O); $(LD) $(LDFLAGS) -o $@ $(BD)lburg$(O) $(BD)gram$(O)
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)lburg$(O) $(BD)gram$(O): lburg/lburg.h
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)lburg$(O): lburg/lburg.c; $(CC) $(LCC_CFLAGS) -c -Ilburg -o $@ lburg/lburg.c
|
|
|
|
$(BD)gram$(O): lburg/gram.c; $(CC) $(LCC_CFLAGS) -c -Ilburg -o $@ lburg/gram.c
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
CPPOBJS=$(BD)q3cpp$(O) $(BD)lexer$(O) $(BD)nlist$(O) $(BD)tokens$(O) $(BD)macro$(O) $(BD)eval$(O) \
|
|
|
|
$(BD)include$(O) $(BD)hideset$(O) $(BD)getopt$(O) $(BD)unix$(O)
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-10-04 23:54:51 +00:00
|
|
|
$(BD)q3cpp$(E): $(CPPOBJS)
|
2005-08-26 17:39:27 +00:00
|
|
|
$(LD) $(LDFLAGS) -o $@ $(CPPOBJS)
|
|
|
|
|
|
|
|
$(CPPOBJS): cpp/cpp.h
|
|
|
|
|
2005-10-05 03:13:20 +00:00
|
|
|
$(BD)q3cpp$(O): cpp/cpp.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/cpp.c
|
|
|
|
$(BD)lexer$(O): cpp/lex.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/lex.c
|
|
|
|
$(BD)nlist$(O): cpp/nlist.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/nlist.c
|
|
|
|
$(BD)tokens$(O): cpp/tokens.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/tokens.c
|
|
|
|
$(BD)macro$(O): cpp/macro.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/macro.c
|
|
|
|
$(BD)eval$(O): cpp/eval.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/eval.c
|
|
|
|
$(BD)include$(O): cpp/include.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/include.c
|
|
|
|
$(BD)hideset$(O): cpp/hideset.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/hideset.c
|
|
|
|
$(BD)getopt$(O): cpp/getopt.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/getopt.c
|
|
|
|
$(BD)unix$(O): cpp/unix.c; $(CC) $(LCC_CFLAGS) -c -Icpp -o $@ cpp/unix.c
|
2005-10-04 23:54:51 +00:00
|
|
|
|
2005-08-26 17:39:27 +00:00
|
|
|
install:: all
|
2005-10-29 22:05:20 +00:00
|
|
|
$(INSTALL) -s -m 0755 $(BD)q3lcc$(E) ../
|
|
|
|
$(INSTALL) -s -m 0755 $(BD)q3cpp$(E) ../
|
|
|
|
$(INSTALL) -s -m 0755 $(BD)q3rcc$(E) ../
|
2005-08-26 17:39:27 +00:00
|
|
|
|
|
|
|
uninstall::
|
2005-10-04 23:54:51 +00:00
|
|
|
-$(RM) ../q3lcc$(E)
|
|
|
|
-$(RM) ../q3cpp$(E)
|
|
|
|
-$(RM) ../q3rcc$(E)
|
2005-08-26 17:39:27 +00:00
|
|
|
|
2005-11-02 15:28:16 +00:00
|
|
|
clean::
|
2005-10-05 03:13:20 +00:00
|
|
|
$(RM) $(BD)*$(O)
|
2005-11-02 15:28:16 +00:00
|
|
|
$(RM) $(BD)dagcheck.c $(BD)gram.c
|
2005-10-04 23:54:51 +00:00
|
|
|
$(RM) $(BD)rcc.c $(BD)rcc.h
|
|
|
|
$(RM) $(BD)rcc1$(E) $(BD)rcc1$(E) $(BD)1rcc$(E) $(BD)2rcc$(E)
|
|
|
|
$(RM) $(BD)*.ilk
|
2005-10-26 22:59:30 +00:00
|
|
|
$(RM) -r $(BD)
|
2005-08-26 17:39:27 +00:00
|
|
|
|
|
|
|
clobber:: clean
|
2005-11-02 16:05:14 +00:00
|
|
|
$(RM) $(BD)q3rcc$(E) $(BD)2html$(E) $(BD)lburg$(E) $(BD)q3cpp$(E) $(BD)q3lcc$(E) $(BD)bprint$(E) $(BD)*$(A)
|
2005-10-04 23:54:51 +00:00
|
|
|
$(RM) $(BD)*.pdb $(BD)*.pch
|
2005-08-26 17:39:27 +00:00
|
|
|
|
|
|
|
RCCSRCS=src/alloc.c \
|
|
|
|
src/bind.c \
|
|
|
|
src/dag.c \
|
|
|
|
src/decl.c \
|
|
|
|
src/enode.c \
|
|
|
|
src/error.c \
|
|
|
|
src/expr.c \
|
|
|
|
src/event.c \
|
|
|
|
src/init.c \
|
|
|
|
src/inits.c \
|
|
|
|
src/input.c \
|
|
|
|
src/lex.c \
|
|
|
|
src/list.c \
|
|
|
|
src/main.c \
|
|
|
|
src/output.c \
|
|
|
|
src/prof.c \
|
|
|
|
src/profio.c \
|
|
|
|
src/simp.c \
|
|
|
|
src/stmt.c \
|
|
|
|
src/string.c \
|
|
|
|
src/sym.c \
|
|
|
|
src/trace.c \
|
|
|
|
src/tree.c \
|
|
|
|
src/types.c \
|
|
|
|
src/null.c \
|
|
|
|
src/symbolic.c \
|
|
|
|
src/bytecode.c \
|
|
|
|
src/gen.c \
|
|
|
|
src/stab.c \
|
2005-11-02 16:05:14 +00:00
|
|
|
$(BD)dagcheck.c
|
2005-10-04 23:54:51 +00:00
|
|
|
|
|
|
|
C=$(BD)q3lcc -A -d0.6 -Wo-lccdir=$(BUILDDIR) -Isrc -I$(BUILDDIR)
|
|
|
|
triple: $(BD)q3rcc$(E) $(BD)q3lcc$(E) $(BD)q3cpp$(E)
|
|
|
|
$C -o $(BD)1rcc$(E) -B$(BD) $(RCCSRCS)
|
|
|
|
$C -o $(BD)2rcc$(E) -B$(BD)1 $(RCCSRCS)
|
|
|
|
strip $(BD)1rcc$(E) $(BD)2rcc$(E)
|
|
|
|
dd if=$(BD)1rcc$(E) of=$(BD)rcc1$(E) bs=512 skip=1
|
|
|
|
dd if=$(BD)2rcc$(E) of=$(BD)rcc2$(E) bs=512 skip=1
|
|
|
|
if cmp $(BD)rcc1$(E) $(BD)rcc2$(E); then \
|
|
|
|
mv $(BD)2rcc$(E) $(BD)q3rcc$(E); \
|
|
|
|
$(RM) $(BD)1rcc$(E) $(BD)q3rcc[12]$(E); fi
|