summaryrefslogtreecommitdiffstats
path: root/debian/patches/30-cross.patch
blob: ac7d5fec1e9fa89883747b906e689e4379dd9fe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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