From 3e9eb17523481aa4519f9dabbc68a7ae9785880b Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 30 Oct 2016 22:42:00 +0000 Subject: [PATCH] Set up project --- .gitignore | 2 ++ Makefile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 4 ++++ 3 files changed, 52 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9173d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/* +trumpotron diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ae6b5a1 --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +CC = g++ -std=c++14 +CFLAGS = -g -O0 -Wall --pedantic +LFLAGS = + +RM = rm -f + +SRCDIR = src +TMPDIR = build +TARGET = trumpotron +FILES = main + +#SOURCES = $(patsubst %,$(SRCDIR)/%.cpp,$(FILES)) +OBJECTS = $(patsubst %,$(TMPDIR)/%.o,$(FILES)) +DEPS = $(patsubst %,$(TMPDIR)/%.d,$(FILES)) + +.PHONY: clean run remake + +all: $(TARGET) + +# run the target +run: $(TARGET) + ./$< + +# clean up the build directory +clean: + $(RM) $(TARGET) + $(RM) $(OBJECTS) + $(RM) $(DEPS) + +# clean up and make again +remake: clean $(TARGET) + +# link the final target +$(TARGET): $(OBJECTS) + $(CC) $(OBJECTS) $(LFLAGS) -o $@ + +# compiling to .o file +$(TMPDIR)/%.o: $(SRCDIR)/%.cpp + $(CC) $(CFLAGS) -c $< -o $@ + +# generating .d dependency files +$(TMPDIR)/%.d: $(SRCDIR)/%.cpp + $(CC) $(CFLAGS) -MM $< -MT $(TMPDIR)/$*.o -MF $(TMPDIR)/$*.d + +# using dependency files +-include $(DEPS) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..a46866d --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,4 @@ +int main() +{ + return 0; +}