Skip to content

Instantly share code, notes, and snippets.

@phistep
Created September 7, 2015 20:56
Show Gist options
  • Save phistep/59d65be79466f9db2ade to your computer and use it in GitHub Desktop.
Save phistep/59d65be79466f9db2ade to your computer and use it in GitHub Desktop.
premake Problems
# GNU Make workspace makefile autogenerated by Premake
.NOTPARALLEL:
ifndef config
config=debug
endif
ifndef verbose
SILENT = @
endif
ifeq ($(config),debug)
endif
ifeq ($(config),release)
endif
PROJECTS := vinyl
.PHONY: all clean help $(PROJECTS)
all: $(PROJECTS)
vinyl:
ifneq (,$(vinyl_config))
@echo "==== Building vinyl ($(vinyl_config)) ===="
@${MAKE} --no-print-directory -C . -f vinyl.make config=$(vinyl_config)
endif
clean:
@${MAKE} --no-print-directory -C . -f vinyl.make clean
help:
@echo "Usage: make [config=name] [target]"
@echo ""
@echo "CONFIGURATIONS:"
@echo " debug"
@echo " release"
@echo ""
@echo "TARGETS:"
@echo " all (default)"
@echo " clean"
@echo " vinyl"
@echo ""
@echo "For more information, see http://industriousone.com/premake/quick-start"
--
-- TODO
-- * resolution, threading commandline flags
-- * debug configs not building on windows
--
solution "Demo"
location ("PremakeBuilds/".._ACTION)
configurations {
"Debug",
"Release",
}
filter "system:linux"
defines { "__linux" }
filter "system:windows"
defines { "_WINDOWS" }
filter "configurations:Debug"
defines { "_DEBUG" }
flags {
"Symbols" -- Generate debugging information.
}
filter "configurations:Release"
defines { "NDEBUG" }
flags {
"Symbols" -- Generate debugging information.
}
project "vinyl"
language "C++"
kind "WindowedApp"
targetname "demo"
platforms {
"V2",
"4klang",
}
filter { "platforms:V2", "system:windows" }
defines { "SYNTH_V2" }
filter "platforms:4klang"
defines { "SYNTH_4KLANG" }
filter {}
files {
"Source/**.cpp",
"Source/**.h",
}
removefiles {
"Source/Music/*",
}
libdirs {
"Lib/lib",
"Source/music",
}
-- links { }
includedirs {
"Lib/include",
"Source",
}
filter { "configurations:Release" }
optimize "Size"
filter { "configurations:Debug" }
optimize "Off" -- "Debug"
--
-- Windows
--
filter { "system:windows" }
flags {
"MultiProcessorCompile",
"OmitDefaultLibrary", -- Omit the specification of a runtime library in object files.
"WinMain", -- Use `WinMain()` as entry point for Windows applications, rather than the default `main()`.
}
buildoptions {
"/GS-", -- Disable Security checks
"/MT", -- Runtime Library Multi-threaded
}
linkoptions {
"/NODEFAULTLIB", -- Ignore All Default Libraries
"/SAFESEH:NO", -- Image Has Safe Exception Handers: No
}
links {
"opengl32",
}
exceptionhandling "Off"
-- V2
filter { "platforms:V2", "system:windows" }
files {
"Source/music/soundtrack.v2m",
"Source/music/v2inc.asm",
"Lib/include/libv2.h",
"Lib/include/v2mplayer.cpp",
"Lib/include/v2mplayer.h",
}
links {
"Dsound",
"winmm",
"libv2",
"%{cfg.objdir}/v2inc",
}
filter { "configurations:Debug", "platforms:V2", "system:windows", "files:Source/music/v2inc.asm" }
buildcommands "nasm.exe -f win32 -o %{cfg.objdir}%{file.basename}.lib %{file.abspath}"
buildmessage "%{file.name}"
buildoutputs "%{cfg.objdir}%{file.basename}.lib"
filter { "configurations:Release", "platforms:V2", "system:windows", "files:Source/music/v2inc.asm" }
buildcommands "nasm.exe -f win32 -o %{cfg.objdir}%{file.basename}.lib %{file.abspath} -DNDEBUG%3b"
buildmessage "%{file.name}"
buildoutputs "%{cfg.objdir}%{file.basename}.lib"
-- 4klang
filter { "platforms:4klang", "system:windows" }
files {
"Source/music/4klang.windows.h",
"Source/music/4klang.windows.lib",
}
links {
"winmm",
"4klang.windows",
}
--
-- Linux
--
filter { "system:linux" }
removeplatforms { "V2" }
buildoptions {
"-std=c++11",
"-Wall",
"-Wextra",
}
links {
"GL",
"X11",
"asound",
}
filter { "configurations:release" }
linkoptions {
-- usleep is a problem
-- "-nodefaultlibs",
}
-- 4klang
filter { "platforms:4klang", "system:linux" }
files {
"Source/music/4klang.linux.h",
"Source/music/4klang.linux.o",
}
links {
"Source/music/4klang.linux.o"
}
buildoptions {
"-fno-use-cxa-atexit",
"-m32",
}
linkoptions {
"-m32",
"-pthread",
}
# GNU Make project makefile autogenerated by Premake
ifndef config
config=debug_4klang
endif
ifndef verbose
SILENT = @
endif
.PHONY: clean prebuild prelink
ifeq ($(config),debug_4klang)
RESCOMP = windres
TARGETDIR = bin/4klang/Debug
TARGET = $(TARGETDIR)/demo
OBJDIR = obj/4klang/Debug
DEFINES += -D__linux -D_DEBUG -DSYNTH_4KLANG
INCLUDES += -I../../Lib/include -I../../Source
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -O0 -std=c++11 -Wall -Wextra -fno-use-cxa-atexit -m32
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lX11 -lasound ../../Source/music/4klang.linux.o
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L../../Lib/lib -L../../Source/music -m32 -pthread
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),release_4klang)
RESCOMP = windres
TARGETDIR = bin/4klang/Release
TARGET = $(TARGETDIR)/demo
OBJDIR = obj/4klang/Release
DEFINES += -D__linux -DNDEBUG -DSYNTH_4KLANG
INCLUDES += -I../../Lib/include -I../../Source
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -Os -std=c++11 -Wall -Wextra -fno-use-cxa-atexit -m32
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lX11 -lasound ../../Source/music/4klang.linux.o
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L../../Lib/lib -L../../Source/music -m32 -pthread
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)
@:
endif
OBJECTS := \
$(OBJDIR)/AmbientLight.o \
$(OBJDIR)/BRDFLut.o \
$(OBJDIR)/DataInterpolator.o \
$(OBJDIR)/EnvironmentMap.o \
$(OBJDIR)/Framebuffer.o \
$(OBJDIR)/LinuxFrontend.o \
$(OBJDIR)/Shader.o \
$(OBJDIR)/WindowsFrontend.o \
$(OBJDIR)/main.o \
$(OBJDIR)/quat.o \
$(OBJDIR)/scalar.o \
$(OBJDIR)/stdmath.o \
$(OBJDIR)/vec2.o \
$(OBJDIR)/vec3.o \
$(OBJDIR)/vec4.o \
$(OBJDIR)/stdlib.o \
RESOURCES := \
CUSTOMFILES := \
SHELLTYPE := msdos
ifeq (,$(ComSpec)$(COMSPEC))
SHELLTYPE := posix
endif
ifeq (/bin,$(findstring /bin,$(SHELL)))
SHELLTYPE := posix
endif
$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES) ${CUSTOMFILES}
@echo Linking vinyl
$(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 vinyl
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(OBJDIR)
else
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif
prebuild:
$(PREBUILDCMDS)
prelink:
$(PRELINKCMDS)
ifneq (,$(PCH))
$(OBJECTS): $(GCH) $(PCH)
$(GCH): $(PCH)
@echo $(notdir $<)
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
endif
$(OBJDIR)/AmbientLight.o: ../../Source/AmbientLight.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/BRDFLut.o: ../../Source/BRDFLut.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/DataInterpolator.o: ../../Source/DataInterpolator.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/EnvironmentMap.o: ../../Source/EnvironmentMap.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/Framebuffer.o: ../../Source/Framebuffer.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/LinuxFrontend.o: ../../Source/LinuxFrontend.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/Shader.o: ../../Source/Shader.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/WindowsFrontend.o: ../../Source/WindowsFrontend.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/main.o: ../../Source/main.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/quat.o: ../../Source/math/quat.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/scalar.o: ../../Source/math/scalar.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/stdmath.o: ../../Source/math/stdmath.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/vec2.o: ../../Source/math/vec2.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/vec3.o: ../../Source/math/vec3.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/vec4.o: ../../Source/math/vec4.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/stdlib.o: ../../Source/stdlib.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
-include $(OBJECTS:%.o=%.d)
ifneq (,$(PCH))
-include $(OBJDIR)/$(notdir $(PCH)).d
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment