Skip to content

Commit f215517

Browse files
committed
Full read-only src for Linux out-of-tree build when generated files are up-to-date
1 parent d9d4999 commit f215517

7 files changed

Lines changed: 26 additions & 14 deletions

File tree

builds/posix/Makefile.in

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ IDL_ROOT=$(INCLD_ROOT)/firebird
118118
IDL_FILE=$(IDL_ROOT)/FirebirdInterface.idl
119119
API_H_FILE=$(IDL_ROOT)/IdlFbInterfaces.h
120120
API_PAS_FILE=$(INCLD_ROOT)/gen/Firebird.pas
121+
API_PAS_TMP_FILE=$(TMP_ROOT)/include/gen/Firebird.pas
121122
API_C_HEADER=fb_c_api.h
122123
API_C_H_FILE=$(FIREBIRD)/include/firebird/$(API_C_HEADER)
123124
API_C_TMP_FILE=$(TMP_ROOT)/fb_c_api.tmp
@@ -173,12 +174,17 @@ $(TMP_FUNCS_PAS): $(PASCAL_SOURCES) $(XPB_CONSTS) $(INF_CONSTS) $(TMP_ROOT)/iber
173174
$(RPL_GREP) <$(TMP_ROOT)/iberror.pas >>$(TMP_FUNCS_PAS)
174175

175176
$(API_PAS_FILE): $(IDL_FILE) $(PASCAL_SOURCES) $(TMP_FUNCS_PAS)
176-
$(CLOOP) $(IDL_FILE) pascal $@ Firebird --uses SysUtils \
177+
$(CLOOP) $(IDL_FILE) pascal $(API_PAS_TMP_FILE) Firebird --uses SysUtils \
177178
--interfaceFile $(PAS_ROOT)/Pascal.interface.pas \
178179
--implementationFile $(PAS_ROOT)/Pascal.implementation.pas \
179180
--exceptionClass FbException \
180181
--functionsFile $(TMP_FUNCS_PAS) \
181182
--prefix I
183+
if [ ! -f $@ ] || ! cmp -s $(API_PAS_TMP_FILE) $@; then \
184+
mv -f $(API_PAS_TMP_FILE) $@; \
185+
else \
186+
rm -f $(API_PAS_TMP_FILE); \
187+
fi
182188

183189
updateBuildNum : $(SRC_ROOT)/jrd/build_no.h $(GEN_ROOT)/Make.Version
184190

@@ -355,7 +361,7 @@ endif
355361

356362
master_process:
357363
mkdir -p $(ROOT)/src/include/gen
358-
ln -sf $(ROOT)/src/include/gen/autoconfig.auto $(ROOT)/src/include/gen/autoconfig.h
364+
ln -sf $(ROOT)/gen/autoconfig.auto $(ROOT)/src/include/gen/autoconfig.h
359365
$(MAKE) updateBuildNum
360366
$(MAKE) export_lists
361367
$(MAKE) external
@@ -391,7 +397,7 @@ cross_process:
391397

392398
cross1:
393399
mkdir -p $(ROOT)/src/include/gen
394-
ln -sf $(ROOT)/src/include/gen/autoconfig.auto $(ROOT)/src/include/gen/autoconfig.h
400+
ln -sf $(ROOT)/gen/autoconfig.auto $(ROOT)/src/include/gen/autoconfig.h
395401
$(MAKE) updateBuildNum
396402
$(MAKE) export_lists
397403
$(MAKE) external
@@ -966,7 +972,7 @@ clean_gpre_gen:
966972
-$(RM) -f `find $(TMP_ROOT)/ -type f -name '*.cpp' -print`
967973

968974
clean_yacc_gen:
969-
$(RM) $(ROOT)/src/dsql/parse.cpp $(ROOT)/src/dsql/dsql.tab.h $(ROOT)/src/include/gen/parse.h types.y y.* $(OBJ)/.parse-gen-sentinel
975+
$(RM) $(ROOT)/src/dsql/parse.cpp $(ROOT)/src/dsql/dsql.tab.h $(TMP_ROOT)/include/gen/parse.h types.y y.* $(OBJ)/.parse-gen-sentinel
970976

971977
#___________________________________________________________________________
972978
# Extra platform specific targets

builds/posix/make.rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
# Please don't use compiler/platform specific flags here - nmcc 02-Nov-2002
35-
WFLAGS =-I$(ROOT)/src/include -I$(ROOT)/src/include/gen -I$(SRC_ROOT)/include/gen -I$(SRC_ROOT)/include $(CPPFLAGS) $(LTCSOURCE)
35+
WFLAGS =-I$(ROOT)/src/include -I$(ROOT)/src/include/gen -I$(TMP_ROOT)/include/gen -I$(SRC_ROOT)/include/gen -I$(SRC_ROOT)/include $(CPPFLAGS) $(LTCSOURCE)
3636

3737
ifneq ($(SYSTEM_BOOST_FLG),Y)
3838
WFLAGS += -I$(SRCDIR)/extern/boost

builds/posix/make.shared.targets

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,21 @@
4242
# This rule creates parse.cpp from parse.y
4343
# With make 4.3 this can be simplified with a simple group target (&:) dependency.
4444

45-
$(OBJ)/dsql/parse.cpp $(ROOT)/src/include/gen/parse.h: $(OBJ)/.parse-gen-sentinel ;
45+
$(OBJ)/dsql/parse.cpp $(TMP_ROOT)/include/gen/parse.h: $(OBJ)/.parse-gen-sentinel ;
4646

4747
$(OBJ)/.parse-gen-sentinel: $(SRC_ROOT)/dsql/parse.y $(SRC_ROOT)/dsql/btyacc_fb.ske
4848
sed -n '/%type .*/p' < $< > $(GEN_ROOT)/types.y
4949
sed 's/%type .*//' < $< > $(GEN_ROOT)/y.y
5050
($(BTYACC) -l -d -S $(SRC_ROOT)/dsql/btyacc_fb.ske $(GEN_ROOT)/y.y; echo $$? > $(GEN_ROOT)/y.status) 2>&1 | tee $(GEN_ROOT)/y.txt
5151
(exit `cat $(GEN_ROOT)/y.status`)
52-
sed -n -e "s/.*btyacc: \(.*conflicts.*\)/\1/p" $(GEN_ROOT)/y.txt > $(SRC_ROOT)/dsql/parse-conflicts.txt
52+
sed -n -e "s/.*btyacc: \(.*conflicts.*\)/\1/p" $(GEN_ROOT)/y.txt > $(TMP_ROOT)/dsql/parse-conflicts.txt
53+
cp $(TMP_ROOT)/dsql/parse-conflicts.txt $(ROOT)/src/dsql/parse-conflicts.txt
54+
if [ ! -f $(SRC_ROOT)/dsql/parse-conflicts.txt ] || ! cmp -s $(TMP_ROOT)/dsql/parse-conflicts.txt $(SRC_ROOT)/dsql/parse-conflicts.txt; then \
55+
cp $(TMP_ROOT)/dsql/parse-conflicts.txt $(SRC_ROOT)/dsql/parse-conflicts.txt; \
56+
fi
5357
sed -i -e 's/#define \([A-Z].*\)/#define TOK_\1/' $(GEN_ROOT)/y_tab.h
5458
sed -i -e 's/#define TOK_YY\(.*\)/#define YY\1/' $(GEN_ROOT)/y_tab.h
55-
mkdir -p $(ROOT)/src/include/gen
56-
$(MV) $(GEN_ROOT)/y_tab.h $(ROOT)/src/include/gen/parse.h
59+
$(MV) $(GEN_ROOT)/y_tab.h $(TMP_ROOT)/include/gen/parse.h
5760
$(MV) $(GEN_ROOT)/y_tab.c $(OBJ)/dsql/parse.cpp
5861
touch $@
5962

@@ -65,7 +68,7 @@ $(SRC_ROOT)/gpre/gpre_meta.cpp: $(SRC_ROOT)/gpre/gpre_meta.epp
6568

6669

6770
# Explicit dependence on generated header (parser)
68-
$(OBJ)/dsql/Parser.o $(OBJ)/dsql/Keywords.o $(OBJ)/dsql/dsql.o: $(ROOT)/src/include/gen/parse.h
71+
$(OBJ)/dsql/Parser.o $(OBJ)/dsql/Keywords.o $(OBJ)/dsql/dsql.o: $(TMP_ROOT)/include/gen/parse.h
6972

7073
# Special cases for building cpp from epp
7174
$(OBJ)/dsql/metd.cpp: $(SRC_ROOT)/dsql/metd.epp

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ m4_ifdef([AC_CONFIG_MACRO_DIR],
1313
[m4_define([AC_CONFIG_MACRO_DIR], [])])
1414
AC_CONFIG_MACRO_DIR(m4)
1515

16-
AC_CONFIG_HEADER(src/include/gen/autoconfig.auto:builds/make.new/config/config.h.in)
16+
AC_CONFIG_HEADER(gen/autoconfig.auto:builds/make.new/config/config.h.in)
1717

1818
dnl XE_APPEND(value, varname)
1919
define([XE_APPEND],[[$2]="$[$2] [$1]"])
@@ -1294,6 +1294,9 @@ test "x$CROSS" = "x" || FB_TARGETS="$FB_TARGETS Native"
12941294

12951295
AC_CONFIG_COMMANDS(,,[
12961296
1297+
mkdir -p src/dsql
1298+
mkdir -p src/include/gen
1299+
12971300
FB_TARGETS="$FB_TARGETS"
12981301
for fb_tgt in \$FB_TARGETS; do
12991302

src/dsql/Keywords.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "../common/Token.h"
2727

2828
#define _yacc_defines_yystype
29-
#include "gen/parse.h"
29+
#include "parse.h"
3030

3131
using namespace Firebird;
3232
using namespace Jrd;

src/dsql/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "../common/classes/TriState.h"
3838
#include "../common/classes/stack.h"
3939

40-
#include "gen/parse.h"
40+
#include "parse.h"
4141

4242
namespace Firebird {
4343
class CharSet;

src/dsql/btyacc_fb.ske

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "../jrd/RecordSourceNodes.h"
3030
#include "../common/classes/PodOptional.h"
3131
#include "../common/classes/TriState.h"
32-
#include "gen/parse.h"
32+
#include "parse.h"
3333
#include "../dsql/Parser.h"
3434

3535
%% tables

0 commit comments

Comments
 (0)