audk/BaseTools/Source/C/VfrCompile/GNUmakefile

85 lines
2.6 KiB
Makefile
Raw Normal View History

## @file
# GNU/Linux makefile for 'VfrCompile' module build.
#
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
MAKEROOT ?= ..
APPNAME = VfrCompile
LIBS = -lCommon
TOOL_INCLUDE = -I Pccts/h
#OBJECTS = VfrSyntax.o VfrServices.o DLGLexer.o EfiVfrParser.o ATokenBuffer.o DLexerBase.o AParser.o
OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o VfrSyntax.o \
VfrFormPkg.o VfrError.o VfrUtilityLib.o VfrCompiler.o
VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
# keep BUILD_OPTFLAGS last
VFR_CXXFLAGS = $(BUILD_OPTFLAGS)
BaseTools/VfrCompile: honor EXTRA_LDFLAGS In commit 81502cee20ac ("BaseTools/Source/C: take EXTRA_LDFLAGS from the caller", 2018-08-16), I missed that "VfrCompile/GNUmakefile" does not use BUILD_LFLAGS in the APPLICATION linking rule, unlike "app.makefile" does. Instead, "VfrCompile/GNUmakefile" uses the (undefined) LFLAGS macro. Therefore commit 81502cee20ac did not cover the linking step of VfrCompile. Thankfully, the structure of the linking rules is the same, between "app.makefile" and "VfrCompile/GNUmakefile". Rename the undefined LFLAGS macro in "VfrCompile/GNUmakefile" to VFR_LFLAGS (for consistency with VFR_CXXFLAGS), and set it to EXTRA_LDFLAGS. As a result, we have: | compilation | linking -----------+--------------------------------+---------------------- VfrCompile | VFR_CXXFLAGS = | VFR_LFLAGS = | BUILD_OPTFLAGS = | EXTRA_LDFLAGS | '-O2' + EXTRA_OPTFLAGS | -----------+--------------------------------+---------------------- other apps | BUILD_CFLAGS/BUILD_CXXFLAGS = | BUILD_LFLAGS = | [...] + BUILD_OPTFLAGS = | [...] + EXTRA_LDFLAGS | [...] + '-O2' + EXTRA_OPTFLAGS | This table shows - that the VfrCompile compilation and linking flags are always a subset of the corresponding flags used by the other apps, - and that the EXTRA flags are always at the end. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1540244 Fixes: 81502cee20ac4046f08bb4aec754c7091c8808dc Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-08-17 04:38:02 +02:00
# keep EXTRA_LDFLAGS last
VFR_LFLAGS = $(EXTRA_LDFLAGS)
LINKER = $(BUILD_CXX)
EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
MAKEROOT ?= ../..
include $(MAKEROOT)/Makefiles/header.makefile
APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
.PHONY:all
all: $(MAKEROOT)/bin $(APPLICATION)
$(APPLICATION): $(OBJECTS)
BaseTools/VfrCompile: honor EXTRA_LDFLAGS In commit 81502cee20ac ("BaseTools/Source/C: take EXTRA_LDFLAGS from the caller", 2018-08-16), I missed that "VfrCompile/GNUmakefile" does not use BUILD_LFLAGS in the APPLICATION linking rule, unlike "app.makefile" does. Instead, "VfrCompile/GNUmakefile" uses the (undefined) LFLAGS macro. Therefore commit 81502cee20ac did not cover the linking step of VfrCompile. Thankfully, the structure of the linking rules is the same, between "app.makefile" and "VfrCompile/GNUmakefile". Rename the undefined LFLAGS macro in "VfrCompile/GNUmakefile" to VFR_LFLAGS (for consistency with VFR_CXXFLAGS), and set it to EXTRA_LDFLAGS. As a result, we have: | compilation | linking -----------+--------------------------------+---------------------- VfrCompile | VFR_CXXFLAGS = | VFR_LFLAGS = | BUILD_OPTFLAGS = | EXTRA_LDFLAGS | '-O2' + EXTRA_OPTFLAGS | -----------+--------------------------------+---------------------- other apps | BUILD_CFLAGS/BUILD_CXXFLAGS = | BUILD_LFLAGS = | [...] + BUILD_OPTFLAGS = | [...] + EXTRA_LDFLAGS | [...] + '-O2' + EXTRA_OPTFLAGS | This table shows - that the VfrCompile compilation and linking flags are always a subset of the corresponding flags used by the other apps, - and that the EXTRA flags are always at the end. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1540244 Fixes: 81502cee20ac4046f08bb4aec754c7091c8808dc Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-08-17 04:38:02 +02:00
$(LINKER) -o $(APPLICATION) $(VFR_LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
VfrCompiler.o: ../Include/Common/BuildVersion.h
include $(MAKEROOT)/Makefiles/footer.makefile
VfrSyntax.cpp EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h: Pccts/antlr/antlr VfrSyntax.g
Pccts/antlr/antlr -CC -e3 -ck 3 -k 2 -fl VfrParser.dlg -ft VfrTokens.h -o . VfrSyntax.g
VfrLexer.cpp VfrLexer.h: Pccts/dlg/dlg VfrParser.dlg
Pccts/dlg/dlg -C2 -i -CC -cl VfrLexer -o . VfrParser.dlg
Pccts/antlr/antlr:
BIN_DIR='.' $(MAKE) -C Pccts/antlr
Pccts/dlg/dlg:
BIN_DIR='.' $(MAKE) -C Pccts/dlg
ATokenBuffer.o: Pccts/h/ATokenBuffer.cpp
$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
DLexerBase.o: Pccts/h/DLexerBase.cpp
$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
AParser.o: Pccts/h/AParser.cpp
$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
VfrSyntax.o: VfrSyntax.cpp
$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
clean: localClean
localClean:
BIN_DIR='.' $(MAKE) -C Pccts/antlr clean
BIN_DIR='.' $(MAKE) -C Pccts/dlg clean
rm -f $(EXTRA_CLEAN_OBJECTS)