mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-12-04 18:13:11 +00:00
237 lines
8.1 KiB
Groovy
237 lines
8.1 KiB
Groovy
/* ###
|
|
* IP: GHIDRA
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
// Native build files are already applied in development mode (indicated by presence of the
|
|
// Generic project). Only need to apply them if we are in a distribution.
|
|
if (findProject(':Generic') == null) {
|
|
apply from: "../../../GPL/utils.gradle"
|
|
apply from: "../../../GPL/nativePlatforms.gradle"
|
|
apply from: "../../../GPL/nativeBuildProperties.gradle"
|
|
}
|
|
|
|
/**
|
|
* Define the "native build model" for building the decompiler executables.
|
|
*/
|
|
model {
|
|
|
|
// Define the source files that are compiled and linked to become the decompiler.
|
|
// The decompiler source is a bit weird in that all the cpp and headers all live in
|
|
// the same directory with other files that are not used by the decompiler.
|
|
// That is why we have to list every cpp file that makes up the decomplier.
|
|
components {
|
|
|
|
decompile(NativeExecutableSpec) {
|
|
|
|
baseName "decompile"
|
|
|
|
// these tell gradle for which platforms to build a decompiler executable.
|
|
targetPlatform "win_x86_64"
|
|
targetPlatform "linux_x86_64"
|
|
targetPlatform "linux_arm_64"
|
|
targetPlatform "mac_x86_64"
|
|
targetPlatform "mac_arm_64"
|
|
sources {
|
|
cpp {
|
|
// NOTE: The bison/flex generated files are assumed to be up-to-date.
|
|
// The task `generateParsers` should be executed if needed.
|
|
// builtBy yaccDecompiler
|
|
source {
|
|
srcDir "src/decompile/cpp"
|
|
|
|
include "marshal.cc"
|
|
include "space.cc"
|
|
include "float.cc"
|
|
include "address.cc"
|
|
include "pcoderaw.cc"
|
|
include "translate.cc"
|
|
include "opcodes.cc"
|
|
include "globalcontext.cc"
|
|
include "capability.cc"
|
|
include "architecture.cc"
|
|
include "options.cc"
|
|
include "graph.cc"
|
|
include "cover.cc"
|
|
include "block.cc"
|
|
include "cast.cc"
|
|
include "typeop.cc"
|
|
include "database.cc"
|
|
include "cpool.cc"
|
|
include "comment.cc"
|
|
include "stringmanage.cc"
|
|
include "fspec.cc"
|
|
include "action.cc"
|
|
include "loadimage.cc"
|
|
include "varnode.cc"
|
|
include "op.cc"
|
|
include "type.cc"
|
|
include "variable.cc"
|
|
include "varmap.cc"
|
|
include "jumptable.cc"
|
|
include "emulate.cc"
|
|
include "emulateutil.cc"
|
|
include "flow.cc"
|
|
include "userop.cc"
|
|
include "funcdata.cc"
|
|
include "funcdata_block.cc"
|
|
include "funcdata_varnode.cc"
|
|
include "unionresolve.cc"
|
|
include "funcdata_op.cc"
|
|
include "pcodeinject.cc"
|
|
include "heritage.cc"
|
|
include "prefersplit.cc"
|
|
include "rangeutil.cc"
|
|
include "ruleaction.cc"
|
|
include "subflow.cc"
|
|
include "transform.cc"
|
|
include "blockaction.cc"
|
|
include "merge.cc"
|
|
include "double.cc"
|
|
include "coreaction.cc"
|
|
include "condexe.cc"
|
|
include "override.cc"
|
|
include "dynamic.cc"
|
|
include "crc32.cc"
|
|
include "prettyprint.cc"
|
|
include "printlanguage.cc"
|
|
include "printc.cc"
|
|
include "printjava.cc"
|
|
include "memstate.cc"
|
|
include "opbehavior.cc"
|
|
include "paramid.cc"
|
|
include "ghidra_arch.cc"
|
|
include "inject_ghidra.cc"
|
|
include "ghidra_translate.cc"
|
|
include "loadimage_ghidra.cc"
|
|
include "typegrp_ghidra.cc"
|
|
include "database_ghidra.cc"
|
|
include "ghidra_context.cc"
|
|
include "cpool_ghidra.cc"
|
|
include "ghidra_process.cc"
|
|
include "comment_ghidra.cc"
|
|
include "string_ghidra.cc"
|
|
// include "callgraph.cc" // uncomment for debug
|
|
// include "ifacedecomp.cc" // uncomment for debug
|
|
// include "ifaceterm.cc" // uncomment for debug
|
|
// include "interface.cc" // uncomment for debug
|
|
|
|
// generated source files
|
|
|
|
include "xml.cc"
|
|
// include "grammar.cc" // used by diagnostic console mode
|
|
}
|
|
exportedHeaders {
|
|
srcDir "src/decompile/cpp"
|
|
}
|
|
} // end cpp
|
|
} // end sources
|
|
} // end decompile
|
|
|
|
sleigh(NativeExecutableSpec) {
|
|
targetPlatform "win_x86_64"
|
|
targetPlatform "linux_x86_64"
|
|
targetPlatform "linux_arm_64"
|
|
targetPlatform "mac_x86_64"
|
|
targetPlatform "mac_arm_64"
|
|
sources {
|
|
cpp {
|
|
// NOTE: The bison/flex generated files are assumed to be up-to-date.
|
|
// The task `generateParsers` should be executed if needed.
|
|
// builtBy lexSleigh
|
|
source {
|
|
srcDir "src/decompile/cpp"
|
|
|
|
include "marshal.cc"
|
|
include "space.cc"
|
|
include "float.cc"
|
|
include "address.cc"
|
|
include "pcoderaw.cc"
|
|
include "translate.cc"
|
|
include "opcodes.cc"
|
|
include "globalcontext.cc"
|
|
include "sleigh.cc"
|
|
include "pcodecompile.cc"
|
|
include "sleighbase.cc"
|
|
include "slghsymbol.cc"
|
|
include "slghpatexpress.cc"
|
|
include "slghpattern.cc"
|
|
include "semantics.cc"
|
|
include "context.cc"
|
|
include "filemanage.cc"
|
|
include "slgh_compile.cc"
|
|
|
|
// generated source files
|
|
|
|
include "xml.cc"
|
|
include "pcodeparse.cc"
|
|
include "slghparse.cc"
|
|
include "slghscan.cc"
|
|
}
|
|
exportedHeaders {
|
|
srcDir "src/decompile/cpp"
|
|
}
|
|
} // end cpp
|
|
} // end sources (sleigh)
|
|
} // end sleigh
|
|
|
|
} // end components
|
|
|
|
binaries {
|
|
all{ b ->
|
|
if (b.toolChain in Gcc) {
|
|
b.cppCompiler.args "-std=c++11"
|
|
b.cppCompiler.args "-Wall"
|
|
b.cppCompiler.args "-O2" // for DEBUG, comment this line out
|
|
// b.cppCompiler.args "-g" // for DEBUG, uncomment this line
|
|
b.cppCompiler.args "-Wno-sign-compare"
|
|
if (b.targetPlatform.operatingSystem.linux) {
|
|
// b.linker.args "-static"
|
|
b.cppCompiler.define "LINUX"
|
|
b.cppCompiler.define "_LINUX"
|
|
}
|
|
}
|
|
else if (b.toolChain in VisualCpp) {
|
|
b.cppCompiler.args "/EHsc"
|
|
b.cppCompiler.define "_SECURE_SCL=0"
|
|
b.cppCompiler.define "_HAS_ITERATOR_DEBUGGING=0"
|
|
// b.cppCompiler.args "/Zi" // for DEBUG, uncomment this line
|
|
// b.cppCompiler.args "/FS" // for DEBUG, uncomment this line
|
|
// b.linker.args "/DEBUG" // for DEBUG, uncomment this line
|
|
if (b.targetPlatform.operatingSystem.windows) {
|
|
b.cppCompiler.define "WINDOWS"
|
|
b.cppCompiler.define "_WINDOWS"
|
|
b.cppCompiler.define "WIN32"
|
|
b.cppCompiler.define "_WIN32"
|
|
if (b.targetPlatform.name == "win_x86_64") {
|
|
b.cppCompiler.define "WIN64"
|
|
b.cppCompiler.define "_WIN64"
|
|
}
|
|
}
|
|
}
|
|
else if (b.toolChain in Clang) {
|
|
b.cppCompiler.args "-std=c++11"
|
|
b.cppCompiler.args "-Wall"
|
|
b.cppCompiler.args "-O2" // for DEBUG, comment this line out
|
|
// b.cppCompiler.args "-g" // for DEBUG, uncomment this line
|
|
b.cppCompiler.args "-Wno-sign-compare"
|
|
b.cppCompiler.args "-w"
|
|
if (b.targetPlatform.operatingSystem.linux) {
|
|
// b.linker.args "-static"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} // end model
|