SRC = API/JSBase.cpp \
    API/JSCTestRunnerUtils.cpp \
    API/JSCallbackConstructor.cpp \
    API/JSCallbackFunction.cpp \
    API/JSCallbackObject.cpp \
    API/JSClassRef.cpp \
    API/JSContextRef.cpp \
    API/JSObjectRef.cpp \
    API/JSProfilerPrivate.cpp \
    API/JSScriptRef.cpp \
    API/JSStringRef.cpp \
    API/JSValueRef.cpp \
    API/JSWeakObjectMapRefPrivate.cpp \
    API/OpaqueJSString.cpp \
    assembler/LinkBuffer.cpp \
    assembler/MacroAssembler.cpp \
    assembler/MacroAssemblerX86Common.cpp \
    bindings/ScriptFunctionCall.cpp \
    bindings/ScriptObject.cpp \
    bindings/ScriptValue.cpp \
    builtins/BuiltinExecutables.cpp \
    bytecode/ArrayAllocationProfile.cpp \
    bytecode/ArrayProfile.cpp \
    bytecode/BytecodeBasicBlock.cpp \
    bytecode/BytecodeLivenessAnalysis.cpp \
    bytecode/CallLinkInfo.cpp \
    bytecode/CallLinkStatus.cpp \
    bytecode/CodeBlock.cpp \
    bytecode/CodeBlockHash.cpp \
    bytecode/CodeBlockJettisoningWatchpoint.cpp \
    bytecode/CodeOrigin.cpp \
    bytecode/CodeType.cpp \
    bytecode/DFGExitProfile.cpp \
    bytecode/DeferredCompilationCallback.cpp \
    bytecode/ExecutionCounter.cpp \
    bytecode/ExitKind.cpp \
    bytecode/ExitingJITType.cpp \
    bytecode/GetByIdStatus.cpp \
    bytecode/GetByIdVariant.cpp \
    bytecode/InlineCallFrameSet.cpp \
    bytecode/JumpTable.cpp \
    bytecode/LazyOperandValueProfile.cpp \
    bytecode/MethodOfGettingAValueProfile.cpp \
    bytecode/Opcode.cpp \
    bytecode/PolymorphicGetByIdList.cpp \
    bytecode/PolymorphicPutByIdList.cpp \
    bytecode/PreciseJumpTargets.cpp \
    bytecode/ProfiledCodeBlockJettisoningWatchpoint.cpp \
    bytecode/PutByIdStatus.cpp \
    bytecode/PutByIdVariant.cpp \
    bytecode/ReduceWhitespace.cpp \
    bytecode/SamplingTool.cpp \
    bytecode/SpecialPointer.cpp \
    bytecode/SpeculatedType.cpp \
    bytecode/StructureStubClearingWatchpoint.cpp \
    bytecode/StructureStubInfo.cpp \
    bytecode/UnlinkedCodeBlock.cpp \
    bytecode/UnlinkedInstructionStream.cpp \
    bytecode/ValueRecovery.cpp \
    bytecode/Watchpoint.cpp \
    bytecompiler/BytecodeGenerator.cpp \
    bytecompiler/NodesCodegen.cpp \
    debugger/Debugger.cpp \
    debugger/DebuggerActivation.cpp \
    debugger/DebuggerCallFrame.cpp \
    dfg/DFGAbstractHeap.cpp \
    dfg/DFGAbstractValue.cpp \
    dfg/DFGArgumentsSimplificationPhase.cpp \
    dfg/DFGArithMode.cpp \
    dfg/DFGArrayMode.cpp \
    dfg/DFGAtTailAbstractState.cpp \
    dfg/DFGAvailability.cpp \
    dfg/DFGBackwardsPropagationPhase.cpp \
    dfg/DFGBasicBlock.cpp \
    dfg/DFGBinarySwitch.cpp \
    dfg/DFGBlockInsertionSet.cpp \
    dfg/DFGByteCodeParser.cpp \
    dfg/DFGCFAPhase.cpp \
    dfg/DFGCFGSimplificationPhase.cpp \
    dfg/DFGCPSRethreadingPhase.cpp \
    dfg/DFGCSEPhase.cpp \
    dfg/DFGCapabilities.cpp \
    dfg/DFGClobberSet.cpp \
    dfg/DFGClobberize.cpp \
    dfg/DFGCommon.cpp \
    dfg/DFGCommonData.cpp \
    dfg/DFGCompilationKey.cpp \
    dfg/DFGCompilationMode.cpp \
    dfg/DFGConstantFoldingPhase.cpp \
    dfg/DFGCriticalEdgeBreakingPhase.cpp \
    dfg/DFGDCEPhase.cpp \
    dfg/DFGDesiredIdentifiers.cpp \
    dfg/DFGDesiredStructureChains.cpp \
    dfg/DFGDesiredTransitions.cpp \
    dfg/DFGDesiredWatchpoints.cpp \
    dfg/DFGDesiredWeakReferences.cpp \
    dfg/DFGDesiredWriteBarriers.cpp \
    dfg/DFGDisassembler.cpp \
    dfg/DFGDominators.cpp \
    dfg/DFGDriver.cpp \
    dfg/DFGEdge.cpp \
    dfg/DFGFailedFinalizer.cpp \
    dfg/DFGFinalizer.cpp \
    dfg/DFGFixupPhase.cpp \
    dfg/DFGFlushFormat.cpp \
    dfg/DFGFlushedAt.cpp \
    dfg/DFGFunctionWhitelist.cpp \
    dfg/DFGGraph.cpp \
    dfg/DFGGraphSafepoint.cpp \
    dfg/DFGInPlaceAbstractState.cpp \
    dfg/DFGIntegerCheckCombiningPhase.cpp \
    dfg/DFGInvalidationPointInjectionPhase.cpp \
    dfg/DFGJITCode.cpp \
    dfg/DFGJITCompiler.cpp \
    dfg/DFGJITFinalizer.cpp \
    dfg/DFGJumpReplacement.cpp \
    dfg/DFGLICMPhase.cpp \
    dfg/DFGLazyJSValue.cpp \
    dfg/DFGLivenessAnalysisPhase.cpp \
    dfg/DFGLongLivedState.cpp \
    dfg/DFGLoopPreHeaderCreationPhase.cpp \
    dfg/DFGMinifiedNode.cpp \
    dfg/DFGNaturalLoops.cpp \
    dfg/DFGNode.cpp \
    dfg/DFGNodeFlags.cpp \
    dfg/DFGOSRAvailabilityAnalysisPhase.cpp \
    dfg/DFGOSREntry.cpp \
    dfg/DFGOSREntrypointCreationPhase.cpp \
    dfg/DFGOSRExit.cpp \
    dfg/DFGOSRExitBase.cpp \
    dfg/DFGOSRExitCompiler.cpp \
    dfg/DFGOSRExitCompiler32_64.cpp \
    dfg/DFGOSRExitCompiler64.cpp \
    dfg/DFGOSRExitCompilerCommon.cpp \
    dfg/DFGOSRExitJumpPlaceholder.cpp \
    dfg/DFGOSRExitPreparation.cpp \
    dfg/DFGOperations.cpp \
    dfg/DFGPhase.cpp \
    dfg/DFGPlan.cpp \
    dfg/DFGPredictionInjectionPhase.cpp \
    dfg/DFGPredictionPropagationPhase.cpp \
    dfg/DFGResurrectionForValidationPhase.cpp \
    dfg/DFGSSAConversionPhase.cpp \
    dfg/DFGSSALoweringPhase.cpp \
    dfg/DFGSafepoint.cpp \
    dfg/DFGSpeculativeJIT.cpp \
    dfg/DFGSpeculativeJIT32_64.cpp \
    dfg/DFGSpeculativeJIT64.cpp \
    dfg/DFGStackLayoutPhase.cpp \
    dfg/DFGStaticExecutionCountEstimationPhase.cpp \
    dfg/DFGStoreBarrierElisionPhase.cpp \
    dfg/DFGStrengthReductionPhase.cpp \
    dfg/DFGThreadData.cpp \
    dfg/DFGThunks.cpp \
    dfg/DFGTierUpCheckInjectionPhase.cpp \
    dfg/DFGTypeCheckHoistingPhase.cpp \
    dfg/DFGUnificationPhase.cpp \
    dfg/DFGUseKind.cpp \
    dfg/DFGValidate.cpp \
    dfg/DFGValueSource.cpp \
    dfg/DFGVariableAccessData.cpp \
    dfg/DFGVariableAccessDataDump.cpp \
    dfg/DFGVariableEvent.cpp \
    dfg/DFGVariableEventStream.cpp \
    dfg/DFGVirtualRegisterAllocationPhase.cpp \
    dfg/DFGWatchpointCollectionPhase.cpp \
    dfg/DFGWorklist.cpp \
    disassembler/ARMv7Disassembler.cpp \
    disassembler/Disassembler.cpp \
    disassembler/LLVMDisassembler.cpp \
    disassembler/UDis86Disassembler.cpp \
    disassembler/X86Disassembler.cpp \
    heap/BlockAllocator.cpp \
    heap/CodeBlockSet.cpp \
    heap/ConservativeRoots.cpp \
    heap/CopiedSpace.cpp \
    heap/CopyVisitor.cpp \
    heap/DeferGC.cpp \
    heap/EdenGCActivityCallback.cpp \
    heap/FullGCActivityCallback.cpp \
    heap/GCActivityCallback.cpp \
    heap/GCLogging.cpp \
    heap/GCThread.cpp \
    heap/GCThreadSharedData.cpp \
    heap/HandleSet.cpp \
    heap/HandleStack.cpp \
    heap/Heap.cpp \
    heap/HeapStatistics.cpp \
    heap/HeapTimer.cpp \
    heap/IncrementalSweeper.cpp \
    heap/JITStubRoutineSet.cpp \
    heap/MachineStackMarker.cpp \
    heap/MarkStack.cpp \
    heap/MarkedAllocator.cpp \
    heap/MarkedBlock.cpp \
    heap/MarkedSpace.cpp \
    heap/SlotVisitor.cpp \
    heap/SuperRegion.cpp \
    heap/Weak.cpp \
    heap/WeakBlock.cpp \
    heap/WeakHandleOwner.cpp \
    heap/WeakSet.cpp \
    heap/WriteBarrierBuffer.cpp \
    heap/WriteBarrierSupport.cpp \
    inspector/ConsoleMessage.cpp \
    inspector/ContentSearchUtilities.cpp \
    inspector/IdentifiersFactory.cpp \
    inspector/InjectedScript.cpp \
    inspector/InjectedScriptBase.cpp \
    inspector/InjectedScriptHost.cpp \
    inspector/InjectedScriptManager.cpp \
    inspector/InjectedScriptModule.cpp \
    inspector/InspectorAgentRegistry.cpp \
    inspector/InspectorBackendDispatcher.cpp \
    inspector/InspectorValues.cpp \
    inspector/JSInjectedScriptHost.cpp \
    inspector/JSInjectedScriptHostPrototype.cpp \
    inspector/JSJavaScriptCallFrame.cpp \
    inspector/JSJavaScriptCallFramePrototype.cpp \
    inspector/JavaScriptCallFrame.cpp \
    inspector/ScriptArguments.cpp \
    inspector/ScriptCallFrame.cpp \
    inspector/ScriptCallStack.cpp \
    inspector/ScriptCallStackFactory.cpp \
    inspector/ScriptDebugServer.cpp \
    inspector/agents/InspectorAgent.cpp \
    inspector/agents/InspectorConsoleAgent.cpp \
    inspector/agents/InspectorDebuggerAgent.cpp \
    inspector/agents/InspectorProfilerAgent.cpp \
    inspector/agents/InspectorRuntimeAgent.cpp \
    interpreter/AbstractPC.cpp \
    interpreter/CallFrame.cpp \
    interpreter/Interpreter.cpp \
    interpreter/JSStack.cpp \
    interpreter/ProtoCallFrame.cpp \
    interpreter/StackVisitor.cpp \
    interpreter/VMInspector.cpp \
    jit/AccessorCallJITStubRoutine.cpp \
    jit/AssemblyHelpers.cpp \
    jit/ArityCheckFailReturnThunks.cpp \
    jit/ClosureCallStubRoutine.cpp \
    jit/ExecutableAllocator.cpp \
    jit/ExecutableAllocatorFixedVMPool.cpp \
    jit/GCAwareJITStubRoutine.cpp \
    jit/HostCallReturnValue.cpp \
    jit/JIT.cpp \
    jit/JITArithmetic.cpp \
    jit/JITArithmetic32_64.cpp \
    jit/JITCall.cpp \
    jit/JITCall32_64.cpp \
    jit/JITCode.cpp \
    jit/JITDisassembler.cpp \
    jit/JITExceptions.cpp \
    jit/JITInlineCacheGenerator.cpp \
    jit/JITOpcodes.cpp \
    jit/JITOpcodes32_64.cpp \
    jit/JITOperations.cpp \
    jit/JITPropertyAccess.cpp \
    jit/JITPropertyAccess32_64.cpp \
    jit/JITStubRoutine.cpp \
    jit/JITStubs.cpp \
    jit/JITThunks.cpp \
    jit/JITToDFGDeferredCompilationCallback.cpp \
    jit/Reg.cpp \
    jit/RegisterPreservationWrapperGenerator.cpp \
    jit/RegisterSet.cpp \
    jit/Repatch.cpp \
    jit/ScratchRegisterAllocator.cpp \
    jit/TempRegisterSet.cpp \
    jit/ThunkGenerators.cpp \
    parser/Lexer.cpp \
    parser/Nodes.cpp \
    parser/Parser.cpp \
    parser/ParserArena.cpp \
    parser/SourceCode.cpp \
    parser/SourceProvider.cpp \
    parser/SourceProviderCache.cpp \
    profiler/LegacyProfiler.cpp \
    profiler/Profile.cpp \
    profiler/ProfileGenerator.cpp \
    profiler/ProfileNode.cpp \
    profiler/ProfilerBytecode.cpp \
    profiler/ProfilerBytecodeSequence.cpp \
    profiler/ProfilerBytecodes.cpp \
    profiler/ProfilerCompilation.cpp \
    profiler/ProfilerCompilationKind.cpp \
    profiler/ProfilerCompiledBytecode.cpp \
    profiler/ProfilerDatabase.cpp \
    profiler/ProfilerJettisonReason.cpp \
    profiler/ProfilerOSRExit.cpp \
    profiler/ProfilerOSRExitSite.cpp \
    profiler/ProfilerOrigin.cpp \
    profiler/ProfilerOriginStack.cpp \
    profiler/ProfilerProfiledBytecodes.cpp \
    runtime/ArgList.cpp \
    runtime/Arguments.cpp \
    runtime/ArgumentsIteratorConstructor.cpp \
    runtime/ArgumentsIteratorPrototype.cpp \
    runtime/ArrayBuffer.cpp \
    runtime/ArrayBufferNeuteringWatchpoint.cpp \
    runtime/ArrayBufferView.cpp \
    runtime/ArrayConstructor.cpp \
    runtime/ArrayIteratorConstructor.cpp \
    runtime/ArrayIteratorPrototype.cpp \
    runtime/ArrayPrototype.cpp \
    runtime/BooleanConstructor.cpp \
    runtime/BooleanObject.cpp \
    runtime/BooleanPrototype.cpp \
    runtime/CallData.cpp \
    runtime/CodeCache.cpp \
    runtime/CodeSpecializationKind.cpp \
    runtime/CommonIdentifiers.cpp \
    runtime/CommonSlowPaths.cpp \
    runtime/CommonSlowPathsExceptions.cpp \
    runtime/CompilationResult.cpp \
    runtime/Completion.cpp \
    runtime/ConsoleClient.cpp \
    runtime/ConsolePrototype.cpp \
    runtime/ConstructData.cpp \
    runtime/DataView.cpp \
    runtime/DateConstructor.cpp \
    runtime/DateConversion.cpp \
    runtime/DateInstance.cpp \
    runtime/DatePrototype.cpp \
    runtime/DumpContext.cpp \
    runtime/Error.cpp \
    runtime/ErrorConstructor.cpp \
    runtime/ErrorHandlingScope.cpp \
    runtime/ErrorInstance.cpp \
    runtime/ErrorPrototype.cpp \
    runtime/ExceptionHelpers.cpp \
    runtime/Executable.cpp \
    runtime/FunctionConstructor.cpp \
    runtime/FunctionExecutableDump.cpp \
    runtime/FunctionPrototype.cpp \
    runtime/GetterSetter.cpp \
    runtime/Identifier.cpp \
    runtime/IndexingType.cpp \
    runtime/InitializeThreading.cpp \
    runtime/IntendedStructureChain.cpp \
    runtime/InternalFunction.cpp \
    runtime/JSAPIValueWrapper.cpp \
    runtime/JSActivation.cpp \
    runtime/JSArgumentsIterator.cpp \
    runtime/JSArray.cpp \
    runtime/JSArrayBuffer.cpp \
    runtime/JSArrayBufferConstructor.cpp \
    runtime/JSArrayBufferPrototype.cpp \
    runtime/JSArrayBufferView.cpp \
    runtime/JSArrayIterator.cpp \
    runtime/JSBoundFunction.cpp \
    runtime/JSCJSValue.cpp \
    runtime/JSCell.cpp \
    runtime/JSConsole.cpp \
    runtime/JSDataView.cpp \
    runtime/JSDataViewPrototype.cpp \
    runtime/JSDateMath.cpp \
    runtime/JSFunction.cpp \
    runtime/JSGlobalObject.cpp \
    runtime/JSGlobalObjectFunctions.cpp \
    runtime/JSLock.cpp \
    runtime/JSMap.cpp \
    runtime/JSMapIterator.cpp \
    runtime/JSNameScope.cpp \
    runtime/JSNotAnObject.cpp \
    runtime/JSONObject.cpp \
    runtime/JSObject.cpp \
    runtime/JSPromise.cpp \
    runtime/JSPromiseConstructor.cpp \
    runtime/JSPromiseDeferred.cpp \
    runtime/JSPromiseFunctions.cpp \
    runtime/JSPromiseReaction.cpp \
    runtime/JSPromisePrototype.cpp \
    runtime/JSPropertyNameIterator.cpp \
    runtime/JSProxy.cpp \
    runtime/JSScope.cpp \
    runtime/JSSegmentedVariableObject.cpp \
    runtime/JSSet.cpp \
    runtime/JSSetIterator.cpp \
    runtime/JSString.cpp \
    runtime/JSStringJoiner.cpp \
    runtime/JSSymbolTableObject.cpp \
    runtime/JSTypedArrayConstructors.cpp \
    runtime/JSTypedArrayPrototypes.cpp \
    runtime/JSTypedArrays.cpp \
    runtime/JSVariableObject.cpp \
    runtime/JSWeakMap.cpp \
    runtime/JSWithScope.cpp \
    runtime/JSWrapperObject.cpp \
    runtime/LiteralParser.cpp \
    runtime/Lookup.cpp \
    runtime/MapConstructor.cpp \
    runtime/MapData.cpp \
    runtime/MapIteratorConstructor.cpp \
    runtime/MapIteratorPrototype.cpp \
    runtime/MapPrototype.cpp \
    runtime/MathObject.cpp \
    runtime/MemoryStatistics.cpp \
    runtime/NameConstructor.cpp \
    runtime/NameInstance.cpp \
    runtime/NamePrototype.cpp \
    runtime/NativeErrorConstructor.cpp \
    runtime/NativeErrorPrototype.cpp \
    runtime/NumberConstructor.cpp \
    runtime/NumberObject.cpp \
    runtime/NumberPrototype.cpp \
    runtime/ObjectConstructor.cpp \
    runtime/ObjectPrototype.cpp \
    runtime/Operations.cpp \
    runtime/Options.cpp \
    runtime/PropertyDescriptor.cpp \
    runtime/PropertyNameArray.cpp \
    runtime/PropertySlot.cpp \
    runtime/PropertyTable.cpp \
    runtime/PrototypeMap.cpp \
    runtime/RegExp.cpp \
    runtime/RegExpCache.cpp \
    runtime/RegExpCachedResult.cpp \
    runtime/RegExpConstructor.cpp \
    runtime/RegExpMatchesArray.cpp \
    runtime/RegExpObject.cpp \
    runtime/RegExpPrototype.cpp \
    runtime/SamplingCounter.cpp \
    runtime/SetConstructor.cpp \
    runtime/SetIteratorConstructor.cpp \
    runtime/SetIteratorPrototype.cpp \
    runtime/SetPrototype.cpp \
    runtime/SimpleTypedArrayController.cpp \
    runtime/SmallStrings.cpp \
    runtime/SparseArrayValueMap.cpp \
    runtime/StrictEvalActivation.cpp \
    runtime/StringConstructor.cpp \
    runtime/StringObject.cpp \
    runtime/StringPrototype.cpp \
    runtime/StringRecursionChecker.cpp \
    runtime/Structure.cpp \
    runtime/StructureChain.cpp \
    runtime/StructureIDTable.cpp \
    runtime/StructureRareData.cpp \
    runtime/SymbolTable.cpp \
    runtime/TestRunnerUtils.cpp \
    runtime/TypedArrayController.cpp \
    runtime/TypedArrayType.cpp \
    runtime/VM.cpp \
    runtime/VMEntryScope.cpp \
    runtime/Watchdog.cpp \
    runtime/WatchdogNone.cpp \
    runtime/WeakMapConstructor.cpp \
    runtime/WeakMapData.cpp \
    runtime/WeakMapPrototype.cpp \
    tools/CodeProfile.cpp \
    tools/CodeProfiling.cpp \
    yarr/RegularExpression.cpp \
    yarr/YarrCanonicalizeUCS2.cpp \
    yarr/YarrInterpreter.cpp \
    yarr/YarrJIT.cpp \
    yarr/YarrPattern.cpp \
    yarr/YarrSyntaxChecker.cpp \
    assembler/MacroAssemblerX86Common.cpp \
    llint/LLIntCLoop.cpp \
    llint/LLIntData.cpp \
    llint/LLIntEntrypoint.cpp \
    llint/LLIntExceptions.cpp \
    llint/LLIntSlowPaths.cpp \
    llint/LLIntThunks.cpp \
    llint/LowLevelInterpreter.cpp \
    InspectorJSBackendDispatchers.cpp \
    InspectorJSFrontendDispatchers.cpp \
    InspectorJSTypeBuilders.cpp \
    JSCBuiltins.cpp

OBJ := $(SRC:.cpp=.o)
OBJ := $(OBJ:.cc=.o)

CXXFLAGS += -I API -I ForwardingHeaders -I assembler -I .. -I . -I ../WTF
CXXFLAGS += -I bindings -I builtins -I bytecode -I bytecompiler -I dfg \
		-I disassembler -I ftl -I heap -I debugger -I inspector -I inspector/agents \
		-I interpreter -I jit -I llint -I llvm -I parser -I profiler -I replay \
		-I runtime -I tools -I yarr 
CXXFLAGS += -std=gnu++11 -D_GLIBCXX_USE_SCHED_YIELD -D_GLIBCXX_USE_NANOSLEEP
CXXFLAGS += -DBUILDING_FLTK__
CXXFLAGS += -fno-omit-frame-pointer
CXXFLAGS += $(shell icu-config --cppflags)

include ../Makefile.fltk.shared

LUTS = runtime/ArrayConstructor.cpp \
    runtime/ArrayPrototype.cpp \
    runtime/BooleanPrototype.cpp \
    runtime/DateConstructor.cpp \
    runtime/DatePrototype.cpp \
    runtime/ErrorPrototype.cpp \
    runtime/JSDataViewPrototype.cpp \
    runtime/JSGlobalObject.cpp \
    runtime/JSONObject.cpp \
    runtime/JSPromiseConstructor.cpp \
    runtime/JSPromisePrototype.cpp \
    runtime/NamePrototype.cpp \
    runtime/NumberConstructor.cpp \
    runtime/NumberPrototype.cpp \
    runtime/ObjectConstructor.cpp \
    runtime/RegExpConstructor.cpp \
    runtime/RegExpObject.cpp \
    runtime/RegExpPrototype.cpp \
    runtime/StringConstructor.cpp

OUTLUTS = $(LUTS:.cpp=.lut.h)

.PHONY: all clean gen

NAME = libjsc.a

all: $(OBJ)
	rm -f $(NAME)
	ar cru $(NAME) $(OBJ)
	ranlib $(NAME)
	$(CXX) -o jsc jsc.cpp $(CXXFLAGS) $(NAME) jsc-no-spoof.cpp \
		../WTF/wtf/libwtf.a -pthread \
		$(shell icu-config --ldflags) -ldl -DSTATICALLY_LINKED_WITH_JavaScriptCore \
		-static-libstdc++ `$(FLTKCONFIG) --ldflags`

gen: $(OUTLUTS) Lexer.lut.h RegExpJitTables.h KeywordLookup.h \
		InspectorJS.json LLIntDesiredOffsets.h LLIntOffsetsExtractor

clean:
	rm -f $(OBJ) $(OUTLUTS)

%.lut.h: %.cpp
	./create_hash_table $< -i > $@

Lexer.lut.h: parser/Keywords.table
	./create_hash_table $< -i > $@

RegExpJitTables.h:
	$(PYTHON) ./create_regex_tables > $@

KeywordLookup.h: parser/Keywords.table
	$(PYTHON) ./KeywordLookupGenerator.py $< > $@

JSONS = inspector/protocol/Console.json \
	inspector/protocol/Debugger.json \
	inspector/protocol/GenericTypes.json \
	inspector/protocol/InspectorDomain.json \
	inspector/protocol/Profiler.json \
	inspector/protocol/Runtime.json

BUILTINJS = $(wildcard builtins/*.js)

InspectorJS.json: $(JSONS)
	$(PYTHON) inspector/scripts/generate-combined-inspector-json.py $(JSONS) > $@
	$(PYTHON) inspector/scripts/CodeGeneratorInspector.py InspectorJS.json \
		--output_h_dir . --output_cpp_dir . --output_js_dir \
		../WebInspectorUI/UserInterface/Protocol \
		--output_type JavaScript --write_always
	$(PYTHON) generate-js-builtins $(BUILTINJS) JSCBuiltins.h JSCBuiltins.cpp
	$(PYTHON) inspector/scripts/jsmin.py < inspector/InjectedScriptSource.js \
		> InjectedScriptSource.min.js
	$(PERL) inspector/scripts/xxd.pl InjectedScriptSource_js InjectedScriptSource.min.js \
		InjectedScriptSource.h
	$(PYTHON) generate-bytecode-files --bytecodes_h Bytecodes.h bytecode/BytecodeList.json
	$(PYTHON) generate-bytecode-files --init_bytecodes_asm InitBytecodes.asm \
		bytecode/BytecodeList.json

LLIntDesiredOffsets.h: InspectorJS.json
	$(RUBY) offlineasm/generate_offset_extractor.rb -I. llint/LowLevelInterpreter.asm \
		LLIntDesiredOffsets.h

LLIntOffsetsExtractor: LLIntDesiredOffsets.h InspectorJS.json
	$(CXX) -o LLIntOffsetsExtractor llint/LLIntOffsetsExtractor.cpp \
		$(CXXFLAGS)
	$(RUBY) offlineasm/asm.rb -I. llint/LowLevelInterpreter.asm \
		LLIntOffsetsExtractor LLIntAssembly.h

-include $(OBJ:.o=.d)

%.o: %.cpp
	$(CXX) -c -o $@ $(CXXFLAGS) $<
	@$(CXX) -MM -MP $(CXXFLAGS) -MT $*.o $< -o $*.d
