From d66be2487612e125777056d9e06bde318ff5396e Mon Sep 17 00:00:00 2001 From: Justin Date: Sat, 3 May 2025 23:15:27 -0500 Subject: [PATCH] Initial --- Makefile | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 0 2 files changed, 69 insertions(+) create mode 100644 Makefile create mode 100644 src/main.cpp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bd9d6f6 --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +######################################################################## +####################### Makefile Template ############################## +######################################################################## + +# Compiler settings - Can be customized. +CC = g++ +CXXFLAGS = -std=c++11 -Wall +LDFLAGS = + +# Makefile settings - Can be customized. +APPNAME = Shot-Gun-Pete +EXT = .cpp +SRCDIR = src +OBJDIR = obj + +############## Do not change anything from here downwards! ############# +SRC = $(wildcard $(SRCDIR)/*$(EXT)) +OBJ = $(SRC:$(SRCDIR)/%$(EXT)=$(OBJDIR)/%.o) +DEP = $(OBJ:$(OBJDIR)/%.o=%.d) +# UNIX-based OS variables & settings +RM = rm +DELOBJ = $(OBJ) +# Windows OS variables & settings +DEL = del +EXE = .exe +WDELOBJ = $(SRC:$(SRCDIR)/%$(EXT)=$(OBJDIR)\\%.o) + +######################################################################## +####################### Targets beginning here ######################### +######################################################################## + +all: $(APPNAME) + +# Builds the app +$(APPNAME): $(OBJ) + $(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) + +# Creates the dependecy rules +%.d: $(SRCDIR)/%$(EXT) + @$(CPP) $(CFLAGS) $< -MM -MT $(@:%.d=$(OBJDIR)/%.o) >$@ + +# Includes all .h files +-include $(DEP) + +# Building rule for .o files and its .c/.cpp in combination with all .h +$(OBJDIR)/%.o: $(SRCDIR)/%$(EXT) + $(CC) $(CXXFLAGS) -o $@ -c $< + +################### Cleaning rules for Unix-based OS ################### +# Cleans complete project +.PHONY: clean +clean: + $(RM) $(DELOBJ) $(DEP) $(APPNAME) + +# Cleans only all files with the extension .d +.PHONY: cleandep +cleandep: + $(RM) $(DEP) + +#################### Cleaning rules for Windows OS ##################### +# Cleans complete project +.PHONY: cleanw +cleanw: + $(DEL) $(WDELOBJ) $(DEP) $(APPNAME)$(EXE) + +# Cleans only all files with the extension .d +.PHONY: cleandepw +cleandepw: + $(DEL) $(DEP) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..e69de29