140 lines
3.1 KiB
Text
140 lines
3.1 KiB
Text
|
# Alternative GNU Make project makefile autogenerated by Premake
|
||
|
|
||
|
ifndef config
|
||
|
config=debug
|
||
|
endif
|
||
|
|
||
|
ifndef verbose
|
||
|
SILENT = @
|
||
|
endif
|
||
|
|
||
|
.PHONY: clean prebuild
|
||
|
|
||
|
SHELLTYPE := posix
|
||
|
ifeq (.exe,$(findstring .exe,$(ComSpec)))
|
||
|
SHELLTYPE := msdos
|
||
|
endif
|
||
|
|
||
|
# Configurations
|
||
|
# #############################################
|
||
|
|
||
|
RESCOMP = windres
|
||
|
INCLUDES += -Iinclude -Iinclude/gearlib
|
||
|
FORCE_INCLUDE +=
|
||
|
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
|
||
|
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
|
||
|
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||
|
define PREBUILDCMDS
|
||
|
endef
|
||
|
define PRELINKCMDS
|
||
|
endef
|
||
|
define POSTBUILDCMDS
|
||
|
endef
|
||
|
|
||
|
ifeq ($(config),debug)
|
||
|
TARGETDIR = bin/Debug/test
|
||
|
TARGET = $(TARGETDIR)/test
|
||
|
OBJDIR = obj/Debug/test
|
||
|
DEFINES += -DDEBUG
|
||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g
|
||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g
|
||
|
LIBS += bin/Debug/gearlib/libgearlib.a -lglfw -lm
|
||
|
LDDEPS += bin/Debug/gearlib/libgearlib.a
|
||
|
ALL_LDFLAGS += $(LDFLAGS)
|
||
|
|
||
|
else ifeq ($(config),release)
|
||
|
TARGETDIR = bin/Release/test
|
||
|
TARGET = $(TARGETDIR)/test
|
||
|
OBJDIR = obj/Release/test
|
||
|
DEFINES += -DNDEBUG
|
||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2
|
||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2
|
||
|
LIBS += bin/Release/gearlib/libgearlib.a -lglfw -lm
|
||
|
LDDEPS += bin/Release/gearlib/libgearlib.a
|
||
|
ALL_LDFLAGS += $(LDFLAGS) -s
|
||
|
|
||
|
endif
|
||
|
|
||
|
# Per File Configurations
|
||
|
# #############################################
|
||
|
|
||
|
|
||
|
# File sets
|
||
|
# #############################################
|
||
|
|
||
|
GENERATED :=
|
||
|
OBJECTS :=
|
||
|
|
||
|
GENERATED += $(OBJDIR)/test.o
|
||
|
OBJECTS += $(OBJDIR)/test.o
|
||
|
|
||
|
# Rules
|
||
|
# #############################################
|
||
|
|
||
|
all: $(TARGET)
|
||
|
@:
|
||
|
|
||
|
$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
|
||
|
$(PRELINKCMDS)
|
||
|
@echo Linking test
|
||
|
$(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 test
|
||
|
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)) del /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)/test.o: examples/test.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
|