L5A/Makefile
2024-11-06 17:02:03 -07:00

49 lines
1 KiB
Makefile

# A line starting with a has is a comment, we'll build up
# the below example
TARGET = L5A
SRC_FILES = main.cpp Room.cpp GuessTheNumberRoom.cpp ExitRoom.cpp
# NO EDITS NEEDED BELOW THIS LINE
CXX = g++
CXXFLAGS = -O2
CXXFLAGS_DEBUG = -g
CXXFLAGS_WARN = -Wall -Wextra -Wunreachable-code -Wshadow -Wpedantic
CPPVERSION = -std=c++17
OBJECTS = $(SRC_FILES:.cpp=.o)
ifeq ($(shell echo "Windows"), "Windows")
TARGET := $(TARGET).exe
DEL = del
Q=
else
DEL = rm -f
Q="
endif
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CXX) -o $@ $^
.cpp.o:
$(CXX) $(CXXFLAGS) $(CPPVERSION) $(CXXFLAGS_DEBUG) $(CXXFLAGS_WARN) -o $@ -c $<
clean:
$(DEL) $(TARGET) $(OBJECTS) Makefile.bak
depend:
@sed -i.bak '/^# DEPENDENCIES/,$$d' Makefile
@$(DEL) sed*
@echo $(Q)# DEPENDENCIES$(Q) >> Makefile
@$(CXX) -MM $(SRC_FILES) >> Makefile
.PHONY: all clean depend
# DEPENDENCIES
main.o: main.cpp GuessTheNumberRoom.h Room.h ExitRoom.h
Room.o: Room.cpp Room.h
GuessTheNumberRoom.o: GuessTheNumberRoom.cpp GuessTheNumberRoom.h Room.h
ExitRoom.o: ExitRoom.cpp ExitRoom.h Room.h