about summary refs log tree commit diff
path: root/Rules
diff options
context:
space:
mode:
Diffstat (limited to 'Rules')
-rw-r--r--Rules18
1 files changed, 18 insertions, 0 deletions
diff --git a/Rules b/Rules
index 0531f0fcce..001d9e1e90 100644
--- a/Rules
+++ b/Rules
@@ -38,9 +38,14 @@ export subdir := $(subdir)
 .PHONY: all
 all: objs lib others
 
+ifeq ($(build-programs),yes)
 others: $(addprefix $(objpfx),$(extra-objs) \
 			      $(install-lib) $(install-bin) \
 			      $(install-rootsbin) $(install-sbin))
+else
+others: $(addprefix $(objpfx),$(extra-objs) \
+			      $(install-lib))
+endif
 
 ifneq	"$(findstring env,$(origin headers))" ""
 headers :=
@@ -81,19 +86,32 @@ common-generated := $(common-generated) dummy.o dummy.c empty.c empty.o
 # This makes all the auxiliary and test programs.
 
 .PHONY: others tests
+ifeq ($(build-programs),yes)
 others: $(addprefix $(objpfx),$(others) $(extra-objs))
+else
+others: $(addprefix $(objpfx),$(extra-objs))
+endif
 ifeq ($(cross-compiling),yes)
 tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
 else
 tests: $(tests:%=$(objpfx)%.out)
 endif
 
+ifeq ($(build-programs),yes)
 ifneq "$(strip $(others) $(tests) $(test-srcs))" ""
 $(addprefix $(objpfx),$(others) $(tests) $(test-srcs)): %: %.o \
   $(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
 	$(+link)
 endif
+else
+ifneq "$(strip $(tests) $(test-srcs))" ""
+$(addprefix $(objpfx),$(tests) $(test-srcs)): %: %.o \
+  $(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
+  $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
+	$(+link)
+endif
+endif
 
 ifneq "$(strip $(tests) $(test-srcs))" ""
 # These are the implicit rules for making test outputs