Skip to content

Commit

Permalink
Add mingw buildfiles for util
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Aug 5, 2023
1 parent 9e055e9 commit 2d15018
Show file tree
Hide file tree
Showing 21 changed files with 738 additions and 37 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endif

RESCOMP = windres
TARGETDIR = ..
TARGET = $(TARGETDIR)/bake
TARGET = $(TARGETDIR)/bake.exe
INCLUDES += -I../include -I../util/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
Expand Down
12 changes: 6 additions & 6 deletions drivers/lang/c/build-Darwin/bake_lang_c.make
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ ifeq ($(config),debug)
DEFINES += -DDEBUG
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -fPIC -g
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -fPIC -g
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -fPIC -g -std=c99 -D_XOPEN_SOURCE=600
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -fPIC -g -std=c99 -D_XOPEN_SOURCE=600
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lbake_util
LDDEPS +=
Expand Down Expand Up @@ -61,9 +61,9 @@ ifeq ($(config),release)
DEFINES += -DNDEBUG
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC -std=c99 -D_XOPEN_SOURCE=600
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC -std=c99 -D_XOPEN_SOURCE=600
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lbake_util
LDDEPS +=
Expand Down
4 changes: 2 additions & 2 deletions drivers/lang/c/build-Linux/bake_lang_c.make
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ifeq ($(config),debug)
DEFINES += -DDEBUG
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -fPIC -g -std=c99 -D_XOPEN_SOURCE=600
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -fPIC -g -std=c99 -D_XOPEN_SOURCE=600
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
Expand All @@ -45,7 +45,7 @@ ifeq ($(config),release)
DEFINES += -DNDEBUG
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC -std=c99 -D_XOPEN_SOURCE=600
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC -std=c99 -D_XOPEN_SOURCE=600
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
Expand Down
48 changes: 48 additions & 0 deletions drivers/lang/c/build-MSYS_NT-10.0-22000/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Alternative GNU Make workspace makefile autogenerated by Premake

ifndef config
config=debug
endif

ifndef verbose
SILENT = @
endif

ifeq ($(config),debug)
bake_lang_c_config = debug

else ifeq ($(config),release)
bake_lang_c_config = release

else
$(error "invalid configuration $(config)")
endif

PROJECTS := bake_lang_c

.PHONY: all clean help $(PROJECTS)

all: $(PROJECTS)

bake_lang_c:
ifneq (,$(bake_lang_c_config))
@echo "==== Building bake_lang_c ($(bake_lang_c_config)) ===="
@${MAKE} --no-print-directory -C . -f bake_lang_c.make config=$(bake_lang_c_config)
endif

clean:
@${MAKE} --no-print-directory -C . -f bake_lang_c.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 " bake_lang_c"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"
136 changes: 136 additions & 0 deletions drivers/lang/c/build-MSYS_NT-10.0-22000/bake_lang_c.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# 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
TARGETDIR = ..
TARGET = $(TARGETDIR)/bake_lang_c.dll
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lbake_util
LDDEPS +=
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef

ifeq ($(config),debug)
OBJDIR = ../.bake_cache/debug
DEFINES += -DDEBUG
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g
ALL_LDFLAGS += $(LDFLAGS) -L"$(BAKE_HOME)/lib" -shared -Wl,--out-implib="../bake_lang_c.lib"

else ifeq ($(config),release)
OBJDIR = ../.bake_cache/release
DEFINES += -DNDEBUG
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2
ALL_LDFLAGS += $(LDFLAGS) -L"$(BAKE_HOME)/lib" -shared -Wl,--out-implib="../bake_lang_c.lib" -s

endif

# Per File Configurations
# #############################################


# File sets
# #############################################

GENERATED :=
OBJECTS :=

GENERATED += $(OBJDIR)/main.o
OBJECTS += $(OBJDIR)/main.o

# Rules
# #############################################

all: $(TARGET)
@:

$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
$(PRELINKCMDS)
@echo Linking bake_lang_c
$(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 bake_lang_c
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)/main.o: ../src/main.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
6 changes: 3 additions & 3 deletions drivers/lang/c/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ workspace "bake_lang_c"
configurations { "debug", "release" }
location "build"

configuration { "linux", "gmake" }
filter { "action:gmake" }
buildoptions { "-std=c99", "-D_XOPEN_SOURCE=600" }

project "bake_lang_c"
Expand All @@ -20,10 +20,10 @@ workspace "bake_lang_c"
links { "bake_util" }
libdirs { "$(BAKE_HOME)/lib" }

configuration "debug"
filter "debug"
defines { "DEBUG" }
symbols "On"

configuration "release"
filter "release"
defines { "NDEBUG" }
optimize "On"
3 changes: 3 additions & 0 deletions drivers/lang/c/run_premake.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
rm -rf build-Darwin
rm -rf build-Linux
rm -rf build-MSYS_NT-10.0-22000
../../../../premake5 --os=macosx gmake
mv build build-Darwin
../../../../premake5 --os=linux gmake
mv build build-Linux
../../../../premake5 --os=windows gmake2
mv build build-MSYS_NT-10.0-22000
12 changes: 6 additions & 6 deletions drivers/lang/cpp/build-Darwin/bake_lang_cpp.make
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ ifeq ($(config),debug)
DEFINES += -DDEBUG
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -fPIC -g
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -fPIC -g
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -fPIC -g -std=c99 -D_XOPEN_SOURCE=600
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -fPIC -g -std=c99 -D_XOPEN_SOURCE=600
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lbake_util
LDDEPS +=
Expand Down Expand Up @@ -61,9 +61,9 @@ ifeq ($(config),release)
DEFINES += -DNDEBUG
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC -std=c99 -D_XOPEN_SOURCE=600
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC -std=c99 -D_XOPEN_SOURCE=600
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lbake_util
LDDEPS +=
Expand Down
4 changes: 2 additions & 2 deletions drivers/lang/cpp/build-Linux/bake_lang_cpp.make
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ifeq ($(config),debug)
DEFINES += -DDEBUG
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -fPIC -g -std=c99 -D_XOPEN_SOURCE=600
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -fPIC -g -std=c99 -D_XOPEN_SOURCE=600
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
Expand All @@ -45,7 +45,7 @@ ifeq ($(config),release)
DEFINES += -DNDEBUG
INCLUDES += -I.. -I"$(BAKE_HOME)/include"
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC -std=c99 -D_XOPEN_SOURCE=600
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -fPIC -std=c99 -D_XOPEN_SOURCE=600
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
Expand Down
48 changes: 48 additions & 0 deletions drivers/lang/cpp/build-MSYS_NT-10.0-22000/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Alternative GNU Make workspace makefile autogenerated by Premake

ifndef config
config=debug
endif

ifndef verbose
SILENT = @
endif

ifeq ($(config),debug)
bake_lang_cpp_config = debug

else ifeq ($(config),release)
bake_lang_cpp_config = release

else
$(error "invalid configuration $(config)")
endif

PROJECTS := bake_lang_cpp

.PHONY: all clean help $(PROJECTS)

all: $(PROJECTS)

bake_lang_cpp:
ifneq (,$(bake_lang_cpp_config))
@echo "==== Building bake_lang_cpp ($(bake_lang_cpp_config)) ===="
@${MAKE} --no-print-directory -C . -f bake_lang_cpp.make config=$(bake_lang_cpp_config)
endif

clean:
@${MAKE} --no-print-directory -C . -f bake_lang_cpp.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 " bake_lang_cpp"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"
Loading

0 comments on commit 2d15018

Please sign in to comment.