Incorrect way of enabling stub extensions

Reporter: k0T0z  |  Status: open  |  Last Modified: April 01, 2024, 11:41:40 pm
Currently, when you need to enable a stub for an extension, you will have to create a separate code for it inside the Engine makefile like here:

# If DataStructures extension not enabled, enable DataStructures stub.
ifeq (,$(findstring Universal_System/Extensions/DataStructures, $(EXTENSIONS)))
include Universal_System/StubExtensions/DataStructures/Makefile
endif

and here:

# If Steamworks extension not enabled, enable Steamworks stub.
# Else build the fake library.
ifeq (,$(findstring Universal_System/Extensions/Steamworks, $(EXTENSIONS)))
include Universal_System/StubExtensions/Steamworks/Makefile
else
compile_game: $(STEAM_FAKE_LIB)
clean: steam_clean
endif

This is incorrect and unnecessary, I would like to loop over all the extensions and enable its stub if the extension is disabled and the stub exists.

evil-user  

@k0T0z @JoshDreamland is there any advantage by implementing this change i see only 2 extensions in the makefile .

JoshDreamland  
@evil-user this is a sort of technical debt payoff; it's not as though this issue will kill us, which is why we marked it a "Good First Issue" and left it alone. It's just a little bit of an ugly hack in the way we do makefiles. As Saif said, the better way is to do $(wildcard) matching with $(addprefix) / $(addsuffix) on the $(EXTENSIONS) variable to filter for makefiles that exist under each extension folder. A relatively simple change that a prospective contributor just needs to implement and verify before checking it in.
k0T0z  
@evil-user As Josh said, I have nothing to add. The 2nd main purpose of this change is to reduce the number of changes needed for the makefile as making too many changes is error-prone. Also, note that I removed these two lines inside my last PR #2363:

 compile_game: $(STEAM_FAKE_LIB) 
 clean: steam_clean 

to be:

 ifeq (,$(findstring Universal_System/Extensions/Steamworks, $(EXTENSIONS))) 
 include Universal_System/StubExtensions/Steamworks/Makefile 
 endif 

So Steamworks extension is not a special case anymore.

Daksh-10  
@JoshDreamland @k0T0z
I tried to change the below code
https://github.com/enigma-dev/enigma-dev/blob/3918af3dc40734465b355a7d52cb9f9f93f5a8d6/ENIGMAsystem/SHELL/Makefile#L124C1-L137C1

to
image

So how in makefile can I test the changes, I tried to learn it, but was not able to understand it

k0T0z  
@Daksh-10 You will have to try to build ENIGMA with all those extensions that have a stub enabled, which are basically: DataStructure and Steamworks. Also, you may have to build Steamworks from that branch (k0T0z:flushing-steamworks-ext) as it has important changes to this makefile. To avoid some errors just work on top of my PR: (#2363). I mean create a new PR with my PR merged into it.
Daksh-10  
@k0T0z, about this issue I found some things,
First, these are the enabled extensions when compiling
image
Second, as there is 'DataStructures' extension , so we dont need to enable its stub it works without it, so we can don't need to include its stub
Third, I tried the wildcard method and asked for a pull request on your branch (k0T0z:flushing-steamworks-ext), it doesn't seem to be working, but it was a valiant effort and I can change it, after giving some time to it

So, is there anything I can do now. (Also there were reasons why I was not contributing, which we can discuss on discord)

aryankumar899  
I want to contribute your issue please approach me
Please sign in to post comments, or you can view this issue on GitHub.