Skip to contentSkip to conversation

stubdom: fix make clean and distclean on a freshly cloned tree

PATCH Superseded Wei Liu 2 participants 5 messages Mar 2, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 stubdom: fix make clean and distclean on a freshly cloned tree

Clean and distclean targets need not depend on existence of the mini-os tree. Don't check for mini-os and don't try to blindly include mini-os's Config.mk when doing clean and distclean.

---
 stubdom/Makefile      | 13 ++++++++-----
 stubdom/c/Makefile    |  2 ++
 stubdom/caml/Makefile |  2 ++
 3 files changed, 12 insertions(+), 5 deletions(-)
stubdom/Makefile +8 -5
index 1a1f263..f339b20 100644
@@ -1,15 +1,18 @@
 XEN_ROOT = $(CURDIR)/..
 MINI_OS = $(XEN_ROOT)/extras/mini-os
 
-ifeq ($(wildcard $(MINI_OS)/Config.mk),)
-$(error Please run `make mini-os-dir' in top-level directory)
-endif
-
 export XEN_OS=MiniOS
 
 export stubdom=y
 export debug=y
-include $(XEN_ROOT)/Config.mk
+
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
+  ifeq ($(wildcard $(MINI_OS)/Config.mk),)
+    $(error Please run `make mini-os-dir' in top-level directory)
+  endif
+  include $(XEN_ROOT)/Config.mk
+endif
+
 -include $(XEN_ROOT)/config/Stubdom.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
stubdom/c/Makefile +2 -0
index c646c26..b252dca 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk
+endif
 
 all: main.a
 
stubdom/caml/Makefile +2 -0
index e79c98d..f550de1 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk
+endif
 
 CAMLLIB = $(shell $(OCAMLC_CROSS_PREFIX)ocamlc -where)
 DEF_CPPFLAGS += -I$(CAMLLIB)
Signature · 1 line
1.9.1
author
#1 lore raw

CC Samuel and Stefano.

Quoted 70 lines · Wei Liu

Clean and distclean targets need not depend on existence of the mini-os tree. Don't check for mini-os and don't try to blindly include mini-os's Config.mk when doing clean and distclean.

---
 stubdom/Makefile      | 13 ++++++++-----
 stubdom/c/Makefile    |  2 ++
 stubdom/caml/Makefile |  2 ++
 3 files changed, 12 insertions(+), 5 deletions(-)
stubdom/Makefile +8 -5
index 1a1f263..f339b20 100644
@@ -1,15 +1,18 @@
 XEN_ROOT = $(CURDIR)/..
 MINI_OS = $(XEN_ROOT)/extras/mini-os
 
-ifeq ($(wildcard $(MINI_OS)/Config.mk),)
-$(error Please run `make mini-os-dir' in top-level directory)
-endif
-
 export XEN_OS=MiniOS
 
 export stubdom=y
 export debug=y
-include $(XEN_ROOT)/Config.mk
+
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
+  ifeq ($(wildcard $(MINI_OS)/Config.mk),)
+    $(error Please run `make mini-os-dir' in top-level directory)
+  endif
+  include $(XEN_ROOT)/Config.mk
+endif
+
 -include $(XEN_ROOT)/config/Stubdom.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
stubdom/c/Makefile +2 -0
index c646c26..b252dca 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk
+endif
 
 all: main.a
 
stubdom/caml/Makefile +2 -0
index e79c98d..f550de1 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk
+endif
 
 CAMLLIB = $(shell $(OCAMLC_CROSS_PREFIX)ocamlc -where)
 DEF_CPPFLAGS += -I$(CAMLLIB)
Signature · 1 line
1.9.1
#2 lore raw
Quoted 8 lines · Wei Liu

stubdom/Makefile

Quoted 8 lines
stubdom/Makefile +6 -1
-include $(XEN_ROOT)/Config.mk
+
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
+  ifeq ($(wildcard $(MINI_OS)/Config.mk),)
 
+    $(error Please run `make mini-os-dir' in top-level directory)
+  endif
+  include $(XEN_ROOT)/Config.mk

I'm not sure why the inclusion of this apparently unrelated file ($(MINI_OS) vs $(XEN_ROOT) is conditionalised here.

If that wasn't here then the two ifeq's could be combined into something like:

ifeq(,$(findstring clean,$(MAKECMDGOALS)$(wildcard $(MINI_OS)/Config.mk))

or is that too subtle?

Quoted 12 lines
Quoted 12 lines
stubdom/Makefile +2 -0
+endif
+
 -include $(XEN_ROOT)/config/Stubdom.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
stubdom/c/Makefile +0 -0
index c646c26..b252dca 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
Quoted 2 lines

stubdom/c/Makefile line 4

Quoted 2 lines
stubdom/c/Makefile +1 -0
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk

XEN_ROOT/Config.mk always exists. Did you misread it as MINI_OS?

(and in the next hunk too)

author
#3 lore raw
Quoted 13 lines · Ian Campbell
Quoted 8 lines · Wei Liu

stubdom/Makefile

Quoted 8 lines
stubdom/Makefile +6 -1
-include $(XEN_ROOT)/Config.mk
+
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
+  ifeq ($(wildcard $(MINI_OS)/Config.mk),)
 
+    $(error Please run `make mini-os-dir' in top-level directory)
+  endif
+  include $(XEN_ROOT)/Config.mk

I'm not sure why the inclusion of this apparently unrelated file ($(MINI_OS) vs $(XEN_ROOT) is conditionalised here.

Quoted 7 lines

If that wasn't here then the two ifeq's could be combined into something like:

ifeq(,$(findstring clean,$(MAKECMDGOALS)$(wildcard $(MINI_OS)/Config.mk))

or is that too subtle?

A bit subtle to me. I used the same line for all three locations so it might be easier to understand the condition.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
stubdom/Makefile +2 -0
+endif
+
 -include $(XEN_ROOT)/config/Stubdom.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
stubdom/c/Makefile +0 -0
index c646c26..b252dca 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
Quoted 5 lines
Quoted 2 lines

stubdom/c/Makefile line 4

Quoted 2 lines
stubdom/c/Makefile +1 -0
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk

XEN_ROOT/Config.mk always exists. Did you misread it as MINI_OS?

No, I don't think I misread.

The subtle thing is that XEN_ROOT/Config.mk has

   include $(XEN_ROOT)/config/$(XEN_OS).mk

Here XEN_OS=MiniOS. Then in MiniOS.mk

   include $(XEN_ROOT)/extras/mini-os/Config.mk

If you don't have extra/mini-os you get an error.

Wei.

Quoted 2 lines

(and in the next hunk too)

#4 lore raw
Quoted 22 lines · Wei Liu
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
stubdom/Makefile +2 -0
+endif
+
 -include $(XEN_ROOT)/config/Stubdom.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
stubdom/c/Makefile +0 -0
index c646c26..b252dca 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
Quoted 5 lines
Quoted 2 lines

stubdom/c/Makefile line 4

Quoted 2 lines
stubdom/c/Makefile +1 -0
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk

XEN_ROOT/Config.mk always exists. Did you misread it as MINI_OS?

No, I don't think I misread.

The subtle thing is that XEN_ROOT/Config.mk has

Quoted 7 lines
   include $(XEN_ROOT)/config/$(XEN_OS).mk

Here XEN_OS=MiniOS. Then in MiniOS.mk

   include $(XEN_ROOT)/extras/mini-os/Config.mk

If you don't have extra/mini-os you get an error.

Ah, that is definitely worth spelling out in the commit log.

(this is the underlying cause of the comments on the first hunk too)

Quoted 5 lines

Wei.

Quoted 2 lines

(and in the next hunk too)