Hecho makefile incremental.

parent 0ca50bb8
Showing with 30 additions and 6 deletions
/build
*.elf
*.nds
obj/
CC = g++
HeaderFiles = Personaje.h Sprite.h Objeto.h Hitbox.h Texto.h GestorPantallas.h PantallaPrincipal.h Fuente.h
CodeFiles = main.cpp Personaje.cpp Sprite.cpp Objeto.cpp Hitbox.cpp Texto.cpp GestorPantallas.cpp PantallaPrincipal.cpp
bin = Executable
Executable: $(CodeFiles) $(HeaderFiles)
$(CC) $(CodeFiles) -w -lSDL2 -lSDL2_image -lSDL2_ttf -o Executable
objdir = obj
code_files_in_obj = $(CodeFiles:%=$(objdir)/%)
objs = $(code_files_in_obj:.cpp=.o)
deps = $(code_files_in_obj:.cpp=.d)
link_flags = -lSDL2 -lSDL2_image -lSDL2_ttf
compile_flags = -w $(link_flags)
$(bin): $(objs)
$(CC) $(objs) $(compile_flags) -o $@
$(objdir)/%.o : %.cpp | $(objdir)
$(CC) -c -o $@ $< $(compile_flags)
$(objdir)/%.d: %.cpp | $(objdir)
$(CC) -M $^ -MT $(patsubst %.d,%.o,$@) -MF $@
$(objdir):
mkdir obj
.PHONY: clean
clean:
- rm $(bin)
- rm -r obj
include $(deps)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment