Skip to content

Commit

Permalink
refactor: reorder LDFLAGS when linking to respect extra flags when pa…
Browse files Browse the repository at this point in the history
…ckaging
  • Loading branch information
edubart committed Nov 8, 2023
1 parent a3fa18b commit b5e2019
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -399,22 +399,22 @@ libcartesi.a: $(LIBCARTESI_OBJS)
$(AR_EXEC) $@ $(LIBCARTESI_OBJS)

$(LIBCARTESI): $(LIBCARTESI_OBJS)
$(CXX) $(LDFLAGS) $(LIBCARTESI_LDFLAGS) -o $@ $(LIBCARTESI_OBJS) $(LIBCARTESI_LIBS)
$(CXX) -o $@ $(LIBCARTESI_OBJS) $(LIBCARTESI_LIBS) $(LDFLAGS) $(LIBCARTESI_LDFLAGS)

$(LIBCARTESI_GRPC): $(LIBCARTESI_GRPC_OBJS)
$(CXX) $(LDFLAGS) $(LIBCARTESI_GRPC_LDFLAGS) -o $@ $(LIBCARTESI_GRPC_OBJS) $(LIBCARTESI_GRPC_LIBS)
$(CXX) -o $@ $(LIBCARTESI_GRPC_OBJS) $(LIBCARTESI_GRPC_LIBS) $(LDFLAGS) $(LIBCARTESI_GRPC_LDFLAGS)

$(LIBCARTESI_JSONRPC): $(LIBCARTESI_JSONRPC_OBJS)
$(CXX) $(LDFLAGS) $(LIBCARTESI_JSONRPC_LDFLAGS) -o $@ $(LIBCARTESI_JSONRPC_OBJS) $(LIBCARTESI_JSONRPC_LIBS)
$(CXX) -o $@ $(LIBCARTESI_JSONRPC_OBJS) $(LIBCARTESI_JSONRPC_LIBS) $(LDFLAGS) $(LIBCARTESI_JSONRPC_LDFLAGS)

cartesi.so: $(LUACARTESI_OBJS)
$(CXX) $(LDFLAGS) $(SOLDFLAGS) -o $@ $(LUACARTESI_OBJS) $(LUACARTESI_LIBS)
$(CXX) -o $@ $(LUACARTESI_OBJS) $(LUACARTESI_LIBS) $(LDFLAGS) $(SOLDFLAGS)

cartesi/grpc.so: $(LUACARTESI_GRPC_OBJS)
$(CXX) $(LDFLAGS) $(SOLDFLAGS) -o $@ $(LUACARTESI_GRPC_OBJS) $(LUACARTESI_GRPC_LIBS)
$(CXX) -o $@ $(LUACARTESI_GRPC_OBJS) $(LUACARTESI_GRPC_LIBS) $(LDFLAGS) $(SOLDFLAGS)

cartesi/jsonrpc.so: $(LUACARTESI_JSONRPC_OBJS)
$(CXX) $(LDFLAGS) $(SOLDFLAGS) -o $@ $(LUACARTESI_JSONRPC_OBJS) $(LUACARTESI_JSONRPC_LIBS)
$(CXX) -o $@ $(LUACARTESI_JSONRPC_OBJS) $(LUACARTESI_JSONRPC_LIBS) $(LDFLAGS) $(SOLDFLAGS)

test: luacartesi
$(LUA) cartesi-machine-tests.lua --test-path="$(CARTESI_TESTS_PATH)" --test=".*" run
Expand Down Expand Up @@ -638,23 +638,23 @@ $(GROUND_TRUTH_DIR)/$(LOG_DIR)/%.json.br: $(CARTESI_TESTS_PATH)/%.bin $(GROUND_T
brotli -j -f $(basename $@)

merkle-tree-hash: $(MERKLE_TREE_HASH_OBJS)
$(CXX) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS) -o $@ $^ $(HASH_LIBS)
$(CXX) -o $@ $^ $(HASH_LIBS) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS)

tests/test-merkle-tree-hash: $(TEST_MERKLE_TREE_HASH_OBJS)
$(CXX) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS) -o $@ $^ $(HASH_LIBS)
$(CXX) -o $@ $^ $(HASH_LIBS) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS)

grpc-interfaces: $(PROTO_SOURCES)

remote-cartesi-machine: $(REMOTE_CARTESI_MACHINE_OBJS)
$(CXX) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS) -o $@ $(REMOTE_CARTESI_MACHINE_OBJS) $(REMOTE_CARTESI_MACHINE_LIBS)
$(CXX) -o $@ $(REMOTE_CARTESI_MACHINE_OBJS) $(REMOTE_CARTESI_MACHINE_LIBS) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS)

jsonrpc-remote-cartesi-machine: $(JSONRPC_REMOTE_CARTESI_MACHINE_OBJS)
$(CXX) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS) -o $@ $(JSONRPC_REMOTE_CARTESI_MACHINE_OBJS) $(JSONRPC_REMOTE_CARTESI_MACHINE_LIBS)
$(CXX) -o $@ $(JSONRPC_REMOTE_CARTESI_MACHINE_OBJS) $(JSONRPC_REMOTE_CARTESI_MACHINE_LIBS) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS)

remote-cartesi-machine: CXXFLAGS := $(PROTOBUF_INC) $(GRPC_INC) $(CXXFLAGS)

tests/test-machine-c-api: $(TEST_MACHINE_C_API_OBJS)
$(CXX) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS) -o $@ $(TEST_MACHINE_C_API_OBJS) $(TEST_MACHINE_C_API_LIBS)
$(CXX) -o $@ $(TEST_MACHINE_C_API_OBJS) $(TEST_MACHINE_C_API_LIBS) $(LDFLAGS) $(CARTESI_EXECUTABLE_LDFLAGS)

.PRECIOUS: %.grpc.pb.cc %.grpc.pb.h %.pb.cc %.pb.h

Expand Down

0 comments on commit b5e2019

Please sign in to comment.