This repository has been archived on 2022-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
fuck-premake-old2/samples/gmake/CppExe/Makefile

98 lines
2.6 KiB
Makefile

# GNU Makefile autogenerated by Premake
# Please build using the solution Makefile at:
# ../Makefile
ifndef CONFIG
CONFIG=Debug
endif
ifeq ($(CONFIG),Debug)
BINDIR := ..
LIBDIR := ..
OBJDIR := obj/Debug
OUTDIR := ..
CPPFLAGS := -MMD
CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g
CXXFLAGS := $(CFLAGS)
LDFLAGS += -L$(BINDIR) -L$(LIBDIR)
LDDEPS :=
RESFLAGS :=
TARGET := CppExe.exe
BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)
endif
ifeq ($(CONFIG),Release)
BINDIR := ..
LIBDIR := ..
OBJDIR := obj/Release
OUTDIR := ..
CPPFLAGS := -MMD
CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O2
CXXFLAGS := $(CFLAGS)
LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -s
LDDEPS :=
RESFLAGS :=
TARGET := CppExe.exe
BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)
endif
OBJECTS := \
$(OBJDIR)/Hello.o \
RESOURCES := \
# Can I have premake check the OS type instead of doing this here?
MKDIR_TYPE := msdos
CMD := $(subst \,\\,$(ComSpec)$(COMSPEC))
ifeq (,$(CMD))
MKDIR_TYPE := posix
endif
ifeq (/bin/sh.exe,$(SHELL))
MKDIR_TYPE := posix
endif
ifeq ($(MKDIR_TYPE),posix)
CMD_MKBINDIR := mkdir -p $(BINDIR)
CMD_MKLIBDIR := mkdir -p $(LIBDIR)
CMD_MKOUTDIR := mkdir -p $(OUTDIR)
CMD_MKOBJDIR := mkdir -p $(OBJDIR)
else
CMD_MKBINDIR := $(CMD) /c if not exist $(subst /,\\,$(BINDIR)) mkdir $(subst /,\\,$(BINDIR))
CMD_MKLIBDIR := $(CMD) /c if not exist $(subst /,\\,$(LIBDIR)) mkdir $(subst /,\\,$(LIBDIR))
CMD_MKOUTDIR := $(CMD) /c if not exist $(subst /,\\,$(OUTDIR)) mkdir $(subst /,\\,$(OUTDIR))
CMD_MKOBJDIR := $(CMD) /c if not exist $(subst /,\\,$(OBJDIR)) mkdir $(subst /,\\,$(OBJDIR))
endif
.PHONY: clean
# I really only need to create OUTDIR; that's the only one that matters!
$(OUTDIR)/$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES)
@echo Linking CppExe
-@$(CMD_MKBINDIR)
-@$(CMD_MKLIBDIR)
-@$(CMD_MKOUTDIR)
@$(BLDCMD)
clean:
@echo Cleaning CppExe
ifeq ($(MKDIR_TYPE),posix)
-@rm -f $(OUTDIR)/$(TARGET)
-@rm -rf $(OBJDIR)
else
-@if exist $(subst /,\,$(OUTDIR)/$(TARGET)) del /q $(subst /,\,$(OUTDIR)/$(TARGET))
-@if exist $(subst /,\,$(OBJDIR)) del /q $(subst /,\,$(OBJDIR))
-@if exist $(subst /,\,$(OBJDIR)) rmdir /s /q $(subst /,\,$(OBJDIR))
endif
# add an "objdir" as first dependency to target and create directories there (or maybe
# call it outdirs and do all required output directories
$(OBJDIR)/Hello.o: Hello.cpp
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CXX) $(CXXFLAGS) -o $@ -c $<
-include $(OBJECTS:%.o=%.d)