VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

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)?

Last edited by superfury on 2018-01-02, 03:26. Edited 1 time in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

This is the unmodified Makefile for Windows(MinGW(64)):
https://bitbucket.org/superfury/unipcemu/src/ … e.win?at=master

Anyone can see what's going wrong with the path adjustments in my previous post?

Edit: Removing the part that replaces :%.c with : makes it compile somewhat, but shows some strange compilations of unfound .d.c source code files as well(which give errors compiling, which continues to the next files)?

Last edited by superfury on 2018-01-02, 03:27. Edited 1 time in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

After fixing some stuff, it now compiles properly again(adding .d.o dummy ruke for those).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io