Index: sqlite3/Makefile.in =================================================================== --- sqlite3.orig/Makefile.in +++ sqlite3/Makefile.in @@ -829,10 +829,20 @@ sqlite3.lo: sqlite3.c # Rules to build the LEMON compiler generator # -lemon$(BEXE): $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c +lemon-for-build$(BEXE): $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c $(BCC) -o $@ $(TOP)/tool/lemon.c cp $(TOP)/tool/lempar.c . +lemon$(TEXE): $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c + $(LTLINK) -o $@ $(TOP)/tool/lemon.c + cp $(TOP)/tool/lempar.c . + +ifeq ($(CROSS_BUILDING),yes) +LEMON_FOR_BUILD = lemon-for-build$(BEXE) +else +LEMON_FOR_BUILD = lemon$(TEXE) +endif + # Rules to build the program that generates the source-id # mksourceid$(BEXE): $(TOP)/tool/mksourceid.c @@ -1117,9 +1127,9 @@ opcodes.h: parse.h $(TOP)/src/vdbe.c $(T # parse.h: parse.c -parse.c: $(TOP)/src/parse.y lemon$(BEXE) +parse.c: $(TOP)/src/parse.y $(LEMON_FOR_BUILD) cp $(TOP)/src/parse.y . - ./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y + ./$(LEMON_FOR_BUILD) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest mksourceid$(BEXE) $(TOP)/VERSION has_tclsh84 $(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h @@ -1241,10 +1251,10 @@ FTS5_SRC = \ $(TOP)/ext/fts5/fts5_varint.c \ $(TOP)/ext/fts5/fts5_vocab.c \ -fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon$(BEXE) +fts5parse.c: $(TOP)/ext/fts5/fts5parse.y $(LEMON_FOR_BUILD) cp $(TOP)/ext/fts5/fts5parse.y . rm -f fts5parse.h - ./lemon$(BEXE) $(OPTS) -S fts5parse.y + ./$(LEMON_FOR_BUILD)$(BEXE) $(OPTS) -S fts5parse.y fts5parse.h: fts5parse.c @@ -1541,7 +1551,10 @@ clean: rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la rm -f sqlite3.h opcodes.* rm -rf .libs .deps - rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz + rm -f $(LEMON_FOR_BUILD) lempar.c parse.* sqlite*.tar.gz +ifeq ($(CROSS_BUILDING), yes) + rm -f lemon$(TEXE) +endif rm -f mkkeywordhash$(BEXE) keywordhash.h rm -f mksourceid$(BEXE) rm -f *.da *.bb *.bbg gmon.out