Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Outputting my object files to the desired directory with $(CC) -o $@ (and removing the mv *.o commands in my target rules) solves my problem. Everything links as expected now.</p> <p>Thanks to <a href="https://stackoverflow.com/users/893/greg-hewgill">Greg</a> and <a href="https://stackoverflow.com/users/377270/sarnold">sarnold</a> who explained how to do this in the comments.</p> <p>My makefile now looks like this:</p> <pre><code>CC = clang++ CFLAGS = -Wall -O3 -flto -m64 MAKE = make RM = \rm -f TARGET-DIR = build OBJ-DIR = $(TARGET-DIR)/obj OBJS = $(addprefix $(OBJ-DIR)/, MCTS.o NodePool.o Node.o FastMath.o \ Board.o Patterns.o FastSet.o FastHash.o FastHash2.o FastHashMap.o) GTP-OBJS = $(addprefix $(OBJ-DIR)/, GtpPlayer.o) GTP-TARGET = $(TARGET-DIR)/go-gtp TEST-OBJS = $(addprefix $(OBJ-DIR)/, TestsMain.o MCTSTests.o NodePoolTests.o \ NodeTests.o FastMathTests.o BoardTests.o FastSetTests.o \ FastHashTests.o FastHash2Tests.o FastHashMapTests.o) TEST-TARGET = $(TARGET-DIR)/go-test .PHONY : all all : $(GTP-TARGET) $(TEST-TARGET) $(GTP-TARGET) : $(GTP-OBJS) $(OBJS) $(CC) $(CFLAGS) $^ -o $@ $(OBJ-DIR)/GtpPlayer.o : GtpPlayer.cpp $(CC) -c $(CFLAGS) $&lt; -o $@ $(OBJ-DIR)/%.o : mcts/%.cpp $(CC) -c $(CFLAGS) $&lt; -o $@ $(OBJ-DIR)/%.o : board/%.cpp $(CC) -c $(CFLAGS) $&lt; -o $@ $(OBJ-DIR)/%.o : struct/%.cpp $(CC) -c $(CFLAGS) $&lt; -o $@ $(TEST-TARGET) : $(TEST-OBJS) $(OBJS) $(CC) $(CFLAGS) $^ -o $@ $(OBJ-DIR)/%.o : test/%.cpp $(CC) -c $(CFLAGS) $&lt; -o $@ .PHONY : clean clean : $(RM) $(OBJ-DIR)/*.o .PHONY : distclean distclean : $(MAKE) clean $(RM) $(GTP-TARGET) $(TEST-TARGET) .PHONY : again again: $(MAKE) distclean $(MAKE) $(GTP-TARGET) $(MAKE) $(TEST-TARGET) .PHONY : tar tar: tar cfv $(GTP-TARGET).tar $(GTP-OBJS) $(OBJS) tar cfv $(TEST-TARGET).tar $(TEST-OBJS) $(OBJS) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload