Question
Makefile help - I need a makefile that will build all of these files in the 'src' folder and release the .o files into the
Makefile help - I need a makefile that will build all of these files in the 'src' folder and release the .o files into the 'rel' folder; however, then I also need the makefile to create a debug build and put all of its files into the 'dbg' folder. The makefile also needs to create the folders dbg and rel beforehand/check if they are already made.
My current makefile:
CXX = g++
CXXFLAGS = -Wall
EXE = hw06
SRCDIR = src
RELDIR = rel
SRCS = main.cpp Critter.cpp Doodlebug.cpp Environment.cpp Ant.cpp
OBJS = $(SRCS:%.cpp=%.o)
OBJS := $(addprefix $(SRCDIR)/, $(OBJS))
.PHONY : all clean
all : $(OBJS)
$(CXX) $(CXXFLAGS) -o $(EXE) $^
$(SRCDIR)/%.o : $(SRCDIR)/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $
clean :
rm -f $(OBJS) core $(EXE)
Program6 dbg rel src Ant.cpp ?Ant.hpp a Critter.cpp ?Critter.hpp ?Doodlebug.cpp Doodlebug.hpp ?Environment.cpp Environment.hpp main.cpp makefile Program6 dbg rel src Ant.cpp ?Ant.hpp a Critter.cpp ?Critter.hpp ?Doodlebug.cpp Doodlebug.hpp ?Environment.cpp Environment.hpp main.cpp makefile
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started