Skip to contentSkip to conversation

kernel build with 'make -r'

upatch Peter Samuelson 1 participant 1 message Nov 19, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The kernel makefiles are completely self-contained, so for a minor speed boost we can use 'make -r -R' aka 'make --no-builtin-rules --no-builtin-variables'.

However, due to an apparent bug in gmake 3.79.1 (possibly others), 'make -r' doesn't work if you use the '$*' variable in non-implicit rules. (The info page specifically warns against doing this.) The symptom is that init/main.o doesn't build.

The following is correct, safe and IMHO more readable anyway:

Makefile renamed from Makefile~ +1 -1
@@ -333,7 +333,7 @@
 	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
 
 init/main.o: init/main.c include/config/MARKER
-	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $<
+	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $@ $<
 
 fs lib mm ipc kernel drivers net: dummy
 	$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@, _dir_$@, $@)

These other patch hunks should be just as safe and correct, but I don't have the architectures to test them..

Peter

arch/cris/boot/rescue/Makefile renamed from arch/cris/boot/rescue/Makefile~ +3 -3
@@ -36,13 +36,13 @@
 	rm ktr.bin tmp2423 kimagerescue_tmp.bin
 
 head.o: head.S
-	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
+	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
 
 testrescue.o: testrescue.S
-	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
+	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
 
 kimagerescue.o: kimagerescue.S
-	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
+	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
 
 clean:
 	rm -f *.o *.bin
arch/sparc/kernel/Makefile renamed from arch/sparc/kernel/Makefile~ +1 -1
@@ -38,7 +38,7 @@
 endif
 
 head.o: head.S
-	$(CC) $(AFLAGS) -ansi -c $*.S -o $*.o
+	$(CC) $(AFLAGS) -ansi -c $< -o $@
 
 check_asm: dummy
 	@if [ ! -r $(HPATH)/asm/asm_offsets.h ] ; then \
arch/sparc64/kernel/Makefile renamed from arch/sparc64/kernel/Makefile~ +1 -1
@@ -43,7 +43,7 @@
 
 head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \
 	etrap.S rtrap.S winfixup.S entry.S
-	$(CC) $(AFLAGS) -ansi -c $*.S -o $*.o
+	$(CC) $(AFLAGS) -ansi -c $< -o $@
 
 #
 # This is just to get the dependencies...