On Tue, Nov 23, 2021 at 03:53:07PM +0200, Andy Shevchenko wrote: > On Tue, Nov 23, 2021 at 09:23:30PM +0800, Chen Yu wrote: > > Compiling the tool when output directory parameter is specified would > > trigger the following error: > > > > make O=/data/test/tmp/ -C tools/power/acpi/ > > > > make: Entering directory '/data/src/kernel/linux/tools/power/acpi' > > DESCEND tools/acpidbg > > make[1]: Entering directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg' > > MKDIR include > > CP include > > CC tools/acpidbg/acpidbg.o > > Assembler messages: > > Fatal error: can't create /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o: No such file or directory > > make[1]: *** [../../Makefile.rules:24: /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o] Error 1 > > make[1]: Leaving directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg' > > make: *** [Makefile:18: acpidbg] Error 2 > > make: Leaving directory '/data/src/kernel/linux/tools/power/acpi' > > > > This is because the output directory has not been created yet. Fix this issue by > > creating the output directory before compiling. > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > Thanks! > Thanks for review. > > > > $(objdir)%.o: %.c $(KERNEL_INCLUDE) > > $(ECHO) " CC " $(subst $(OUTPUT),,$@) > > + $(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null > > Not sure we need the `2>/dev/null` part. > If the 'O=' is a read-only directory, mkdir would print errors and adding 2> would avoid printing it. So the user could focus on the real compile error. without '2>' : make O=/data/test/tmp -C tools/power/acpi/ make: Entering directory '/data/src/kernel/linux/tools/power/acpi' DESCEND tools/acpidbg mkdir: cannot create directory ‘/data/test/tmp/tools’: Permission denied thanks, Chenyu > > $(QUIET) $(CC) -c $(CFLAGS) -o $@ $< > > > > all: $(OUTPUT)$(TOOL) > > -- > > 2.25.1 > > > > -- > With Best Regards, > Andy Shevchenko > >