First post, by superfury
I'm having the unipcemu directory within the repo store project-specific .c-files, while ../../projects_build(BUILD_DIR variable) contains the compiled(.o, .exe, .pbp etc.) files. This worked fine up till now, but I now have split part of the repo in a subrepository(../commonemuframework). Now the paths of the compiled object files for those object paths are positioned one directory up, causing problems.
I've tried replacing the paths before prepending the output directories with pathsubst using subst, but then Make suddenly complains that it has no rule to create the fixed output file? I simply replace ../ with subdir, while the object file compilation rule is simply:
Original(working):
OBJS := $(patsubst %.o,$(BUILD_DIR)/$(BUILD_INTERMEDIATE)/%.o,$(OBJS))
New replacement:
OBJS := $(patsubst %.o,$(BUILD_DIR)/$(BUILD_INTERMEDIATE)/%.o,$(subst ../,parentdir/,$(OBJS)))
Compiler rule for object files:
$(BUILD_DIR)/$(BUILD_INTERMEDIATE)/%.o:%.c
$(info Compiling $<)
@$(MKDIR) -p $(dir $@)
@${CC} $(OPTIMIZATIONFLAGS) ${CFLAGS} $(BUILD_CFLAGS) ${INCLUDE_DIRS} -c $< -o $@
@${CC} $(CFLAGS) $(INCLUDE_DIRS) -c $< -MM -MF $(patsubst %.o,%.d,$@)
@sed -i 's|$(notdir $@):|$@:|' $(patsubst %.o,%.d,$@)
New version(first line changed only):
$(BUILD_DIR)/$(BUILD_INTERMEDIATE)/%.o:$(subst parentdir/,../,%.c)
But why isn't that rule firing like it should(neither new nor old rule when the OBJS path replacement new rule is applied(old one compiles in wrong parent directory(../../projects_build/$(BUILD_NAME) instead)?
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io