organize project and specify directory for object files in Makefile

前端 未结 5 2118
时光取名叫无心
时光取名叫无心 2021-02-09 16:23

Here are my two questions:

  1. I am now learning to manage my code with CVS, and I just want to make a repository for my C++ files, Makefile and bash and python scri

5条回答
  •  被撕碎了的回忆
    2021-02-09 16:43

    1. Your directory structure seems sensible.

    2. I would make an explicit rule for executing the compiler, like

    TARGET_DIR=bin
    SRC_DIR=src
    CXX=g++
    CXXFLAGS=
    ETC=
    
    OBJS=$(TARGET_DIR)/test.o
    
    all: $(OBJS)
    
    $(TARGET_DIR)/%.o: $(SRC_DIR)/%.cc
            $(CXX) -c -o $@ $(CXXFLAGS) $(ETC) $<
    

提交回复
热议问题