github.com/igggame/nebulas-go@v2.1.0+incompatible/nf/nvm/v8/Makefile (about)

     1  # Copyright (C) 2017 go-nebulas authors
     2  #
     3  # This file is part of the go-nebulas library.
     4  #
     5  # the go-nebulas library is free software: you can redistribute it and/or modify
     6  # it under the terms of the GNU General Public License as published by
     7  # the Free Software Foundation, either version 3 of the License, or
     8  # (at your option) any later version.
     9  #
    10  # the go-nebulas library is distributed in the hope that it will be useful,
    11  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  # GNU General Public License for more details.
    14  #
    15  # You should have received a copy of the GNU General Public License
    16  # along with the go-nebulas library.  If not, see <http://www.gnu.org/licenses/>.
    17  #
    18  
    19  CFLAGS=-DBUILDING_DLL -g -fPIC -m64 -Wall -Wextra -Wno-unused-parameter -Wno-unused-result -O2
    20  CXXFLAGS=-DBUILDING_DLL -g -std=c++11 -fno-rtti -fPIC -m64 -Wall -Wextra -Wno-unused-parameter -Wno-unused-result -O2
    21  
    22  LDFLAGS=-fvisibility=hidden
    23  LIBS_PATH=
    24  LIBS=-lpthread -lv8_libbase -lv8_libplatform -licui18n -licuuc
    25  
    26  ifeq ($(shell uname -s),Darwin)
    27  	CC=clang
    28  	CXX=clang++
    29  	LD=clang++
    30  	DYLIB=.dylib
    31  	LDFLAGS+=-Wl,-dead_strip
    32  	LIB_LDFLAGS+=-current_version 1.0 -compatibility_version 1.0
    33  	LIBS+=-lv8_base -lv8_libsampler -lv8_external_snapshot
    34  	V8_BLOB_BIN_PATH=/usr/local/opt/v8/bin
    35  else
    36  # original gcc version is 4.8
    37  	CC=gcc
    38  	CXX=g++
    39  	LD=g++
    40  	DYLIB=.so
    41  	CFLAGS+=-I/usr/local/v8/6.2.414.40/include
    42  	CXXFLAGS+=-I/usr/local/v8/6.2.414.40/include
    43  	LIBS_PATH=-L/usr/local/v8/6.2.414.40/lib
    44  	LIBS+=-lv8
    45  	V8_BLOB_BIN_PATH=/usr/local/v8/6.2.414.40/bin
    46  endif
    47  
    48  .PHONY: engine main clean v8_snapshot_bin install
    49  all: main
    50  
    51  %.c.o : %.c
    52  	$(CC) $(CFLAGS) -c $< -o $<.o
    53  
    54  %.cc.o: %.cc
    55  	$(CXX) $(CXXFLAGS) -c $< -o $<.o
    56  
    57  %.cpp.o: %.cpp
    58  	$(CXX) $(CXXFLAGS) -c $< -o $<.o
    59  
    60  main: samples/main.cc.o samples/memory_storage.cc.o samples/memory_modules.cc.o engine.cc.o allocator.cc.o lib/global.cc.o lib/execution_env.cc.o lib/storage_object.cc.o lib/log_callback.cc.o lib/require_callback.cc.o lib/instruction_counter.cc.o lib/blockchain.cc.o lib/fake_blockchain.cc.o lib/tracing.cc.o lib/file.cc.o lib/util.cc.o lib/typescript.cc.o lib/event.cc.o  lib/crypto.cc.o
    61  	$(LD) $(LDFLAGS) $^ -o $@ $(LIBS_PATH) $(LIBS)
    62  
    63  
    64  engine: engine.cc.o thread_engine.cc.o allocator.cc.o lib/random.cc.o lib/global.cc.o lib/execution_env.cc.o lib/storage_object.cc.o lib/log_callback.cc.o lib/require_callback.cc.o lib/instruction_counter.cc.o lib/blockchain.cc.o lib/tracing.cc.o lib/file.cc.o lib/util.cc.o lib/typescript.cc.o lib/event.cc.o lib/crypto.cc.o
    65  	$(LD) -shared $(LDFLAGS) $^ -o libnebulasv8$(DYLIB) $(LIBS_PATH) $(LIBS)
    66  
    67  install: engine
    68  	-mkdir -p ../native-lib
    69  	-install libnebulasv8$(DYLIB) ../native-lib/
    70  clean:
    71  	-rm -f natives_blob.bin.h snapshot_blob.bin.h;
    72  	-find . -iname '*.o' -exec rm {} \;
    73  	-rm -f main libnebulasv8$(DYLIB);
    74  
    75  v8_snapshot_bin:
    76  	-ln -s $(V8_BLOB_BIN_PATH)/natives_blob.bin .
    77  	-ln -s $(V8_BLOB_BIN_PATH)/snapshot_blob.bin .
    78  	-xxd -i natives_blob.bin natives_blob.bin.h
    79  	-xxd -i snapshot_blob.bin snapshot_blob.bin.h
    80  	-rm natives_blob.bin snapshot_blob.bin