Set up project
This commit is contained in:
commit
5d9d0ef716
4 changed files with 106 additions and 0 deletions
47
Makefile
Normal file
47
Makefile
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
CC = g++ -std=c++17
|
||||
CFLAGS = -g -O0 -Wall --pedantic
|
||||
LFLAGS = -lsfml-system -lsfml-network -lsfml-window -lsfml-graphics
|
||||
|
||||
RM = rm -f
|
||||
|
||||
SOURCEFILES = cpp
|
||||
SRCDIR = src
|
||||
TMPDIR = build
|
||||
TARGET = gross
|
||||
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)/%.$(SOURCEFILES)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
# generating .d dependency files
|
||||
$(TMPDIR)/%.d: $(SRCDIR)/%.$(SOURCEFILES)
|
||||
$(CC) $(CFLAGS) -MM $< -MT $(TMPDIR)/$*.o -MF $(TMPDIR)/$*.d
|
||||
|
||||
# using dependency files
|
||||
-include $(DEPS)
|
||||
Loading…
Add table
Add a link
Reference in a new issue