Set up project
This commit is contained in:
commit
3e9eb17523
3 changed files with 52 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
build/*
|
||||||
|
trumpotron
|
||||||
46
Makefile
Normal file
46
Makefile
Normal file
|
|
@ -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)
|
||||||
4
src/main.cpp
Normal file
4
src/main.cpp
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue