premake-core
premake-core copied to clipboard
Build commands in makefile utilities do not seem to run
What seems to be the problem?
workspace "Foo"
configurations { "Debug" }
project "Bar"
kind "Utility"
postbuildcommands { "echo Hello" }
$ premake5 gmake2
Building configurations...
Running action 'gmake2'...
Done (35ms).
$ make
==== Building Bar (debug) ====
What did you expect to happen? I expected "Hello" to be printed to the console
What have you tried so far?
$ make
$ make Bar
$ make Bar.make
$ make Bar.make all
Seems to also be an issue with prebuildcommands too. Works as expected with vs2022
.
How can we reproduce this? See above.
- [ ] Visual Studio 2022 (vs2022)
- [ ] Visual Studio 2019 (vs2019)
- [ ] Visual Studio 2017 (vs2017)
- [ ] Visual Studio 2015 (vs2015)
- [ ] Visual Studio 2012 (vs2012)
- [ ] Visual Studio 2010 (vs2010)
- [ ] Visual Studio 2008 (vs2008)
- [ ] Visual Studio 2005 (vs2005)
- [ ] GNU Makefile (gmake)
- [x] GNU Makefile 2 (gmake2)
- [ ] XCode (xcode)
- [ ] Codelite
- [ ] Other (Please list below)
What version of Premake are you using?
Note that although this says I am using a -dev
version, I grabbed it directly from premake-5.0.0-beta2-linux.tar.gz
$ ./premake5 --version
premake5 (Premake Build Script Generator) 5.0.0-dev
Anything else we should know?
$ make -v
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Could you also upload the makefile that was generated?
Sure!
Makefile
# Alternative GNU Make workspace makefile autogenerated by Premake
ifndef config
config=debug
endif
ifndef verbose
SILENT = @
endif
ifeq ($(config),debug)
Bar_config = debug
else
$(error "invalid configuration $(config)")
endif
PROJECTS := Bar
.PHONY: all clean help $(PROJECTS)
all: $(PROJECTS)
Bar:
ifneq (,$(Bar_config))
@echo "==== Building Bar ($(Bar_config)) ===="
@${MAKE} --no-print-directory -C . -f Bar.make config=$(Bar_config)
endif
clean:
@${MAKE} --no-print-directory -C . -f Bar.make clean
help:
@echo "Usage: make [config=name] [target]"
@echo ""
@echo "CONFIGURATIONS:"
@echo " debug"
@echo ""
@echo "TARGETS:"
@echo " all (default)"
@echo " clean"
@echo " Bar"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"
Bar.make
# 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
# #############################################
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
@echo Running postbuild commands
echo Hello
endef
# File sets
# #############################################
# Rules
# #############################################
all: $(TARGETDIR) $(TARGET)
@:
$(TARGET):
$(PREBUILDCMDS)
$(PRELINKCMDS)
$(POSTBUILDCMDS)
$(TARGETDIR):
@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(TARGETDIR)
else
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif
clean:
@echo Cleaning Bar
# File Rules
# #############################################
I was having the same issue on windows. Running mingw32-make clean
then mingw32-make
again solved the issue.
Before:
PS E:\Dev\IDJ\pinguim> mingw32-make
"==== Building engine (debug) ===="
"==== Building penguim (debug) ===="
Clean projects:
PS E:\Dev\IDJ\pinguim> mingw32-make clean
Cleaning engine
Cleaning penguim
After:
PS E:\Dev\IDJ\pinguim> mingw32-make
"==== Building engine (debug) ===="
Creating ../obj/debug-windows-x86/engine
"main.cpp"
"myclass.cpp"
Linking engine
"==== Building penguim (debug) ===="
Creating ../obj/debug-windows-x86/penguim
"main.cpp"
"myclass.cpp"
Linking penguim
Running postbuild commands
copy /B /Y C:\SDL32\bin\*.dll ..\build\debug-windows-x86\penguim
C:\SDL32\bin\SDL2.dll
C:\SDL32\bin\SDL2_image.dll
C:\SDL32\bin\SDL2_mixer.dll
C:\SDL32\bin\SDL2_ttf.dll
4 arquivo(s) copiado(s).
copy /B /Y ..\build\debug-windows-x86\engine\*.dll ..\build\debug-windows-x86\penguim
..\build\debug-windows-x86\engine\engine_debug.dll
1 arquivo(s) copiado(s).
Makes me curious if this is a problem with make caching the "build" and thinking that it's already been executed.