diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile | 44 | ||||
-rw-r--r-- | Pong.make | 155 | ||||
-rw-r--r-- | README.txt | 2 | ||||
-rw-r--r-- | premake5.lua | 4 |
5 files changed, 203 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore index e828f53..507befb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,6 @@ pong .flatpak-builder flatpak_repo/ build-dir/ -Makefile -Pong.make *.flatpak bin/ -obj/ \ No newline at end of file +obj/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5a0147d --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +# Alternative GNU Make workspace makefile autogenerated by Premake + +ifndef config + config=release +endif + +ifndef verbose + SILENT = @ +endif + +ifeq ($(config),release) + Pong_config = release + +else + $(error "invalid configuration $(config)") +endif + +PROJECTS := Pong + +.PHONY: all clean help $(PROJECTS) + +all: $(PROJECTS) + +Pong: +ifneq (,$(Pong_config)) + @echo "==== Building Pong ($(Pong_config)) ====" + @${MAKE} --no-print-directory -C . -f Pong.make config=$(Pong_config) +endif + +clean: + @${MAKE} --no-print-directory -C . -f Pong.make clean + +help: + @echo "Usage: make [config=name] [target]" + @echo "" + @echo "CONFIGURATIONS:" + @echo " release" + @echo "" + @echo "TARGETS:" + @echo " all (default)" + @echo " clean" + @echo " Pong" + @echo "" + @echo "For more information, see https://github.com/premake/premake-core/wiki" \ No newline at end of file diff --git a/Pong.make b/Pong.make new file mode 100644 index 0000000..d5501b5 --- /dev/null +++ b/Pong.make @@ -0,0 +1,155 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=release +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +RESCOMP = windres +TARGETDIR = bin/Release +TARGET = $(TARGETDIR)/Pong +OBJDIR = obj +DEFINES += +INCLUDES += +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Og -g -ggdb `pkgconf --cflags raylib` `pkgconf --cflags glfw3` `pkgconf --cflags gl` `pkgconf --cflags sdl2` `pkgconf --cflags SDL2_mixer` `pkgconf --cflags glu` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Og -g -ggdb `pkgconf --cflags raylib` `pkgconf --cflags glfw3` `pkgconf --cflags gl` `pkgconf --cflags sdl2` `pkgconf --cflags SDL2_mixer` `pkgconf --cflags glu` +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -s -g -ggdb `pkgconf --libs raylib` `pkgconf --libs glfw3` `pkgconf --libs gl` `pkgconf --libs sdl2` `pkgconf --libs SDL2_mixer` `pkgconf --libs glu` +LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/ball.o +GENERATED += $(OBJDIR)/enemy.o +GENERATED += $(OBJDIR)/main.o +GENERATED += $(OBJDIR)/marathon.o +GENERATED += $(OBJDIR)/pause.o +GENERATED += $(OBJDIR)/title.o +GENERATED += $(OBJDIR)/versus.o +OBJECTS += $(OBJDIR)/ball.o +OBJECTS += $(OBJDIR)/enemy.o +OBJECTS += $(OBJDIR)/main.o +OBJECTS += $(OBJDIR)/marathon.o +OBJECTS += $(OBJDIR)/pause.o +OBJECTS += $(OBJDIR)/title.o +OBJECTS += $(OBJDIR)/versus.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking Pong + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning Pong +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) rmdir /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/ball.o: src/ball.c + @echo $(notdir $<) + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/enemy.o: src/enemy.c + @echo $(notdir $<) + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/main.o: src/main.c + @echo $(notdir $<) + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/marathon.o: src/marathon.c + @echo $(notdir $<) + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/pause.o: src/pause.c + @echo $(notdir $<) + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/title.o: src/title.c + @echo $(notdir $<) + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/versus.o: src/versus.c + @echo $(notdir $<) + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif \ No newline at end of file diff --git a/README.txt b/README.txt index 4df1215..b6823d8 100644 --- a/README.txt +++ b/README.txt @@ -33,7 +33,7 @@ Build: - SDL2 - SDL2_mixer dependency - SDL2_mixer - For sound - premake5 - To generate build files - - pkgconf (not pkg-config) + - pkg-config - Mesa 2. Run `premake5 check_deps` to make sure you have all dependencies. 3. Run `premake5 gmake2` diff --git a/premake5.lua b/premake5.lua index 193366e..b327395 100644 --- a/premake5.lua +++ b/premake5.lua @@ -36,9 +36,9 @@ project("Pong") trigger = "check_deps", description = "Check if you have all the dependencies installed.", execute = function() - io.write("Pkgconf: ") + io.write("pkg-config: ") io.flush() - Pkgconf_Result = os.executef("which pkgconf") + Pkgconf_Result = os.executef("which pkg-config") AllGood = true if(Pkgconf_Result == nil) then |