Skip to contentSkip to conversation

Makefile reworking

PATCH In review John Levon 3 participants 4 messages Nov 7, 2005 Kbuild

lore
Share & tools
lore

John Levon

author
#0 lore raw

PATCH 1/1 Makefile reworking

# HG changeset patch
# User [email protected]
# Node ID 31053d3bc7d9d81c682bed791b9d099ada7ff313
# Parent d1b5ad8e8b03b5e79d86d0844b46345a0f931390 Create a configs/ directory for OS-specific makefile settings. Add an initial Solaris config.
Consolidate definitions of INSTALL and friends.

Config.mk +3 -57
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 Config.mk
@@ -1,60 +1,6 @@
 # -*- mode: Makefile; -*-
 
-# Currently supported architectures: x86_32, x86_64
-XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
-XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
-XEN_TARGET_X86_PAE  ?= n
+OS = $(shell uname -s)
 
-# Tools to run on system hosting the build
-HOSTCC     = gcc
-HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
-
-AS         = $(CROSS_COMPILE)as
-LD         = $(CROSS_COMPILE)ld
-CC         = $(CROSS_COMPILE)gcc
-CPP        = $(CROSS_COMPILE)gcc -E
-AR         = $(CROSS_COMPILE)ar
-RANLIB     = $(CROSS_COMPILE)ranlib
-NM         = $(CROSS_COMPILE)nm
-STRIP      = $(CROSS_COMPILE)strip
-OBJCOPY    = $(CROSS_COMPILE)objcopy
-OBJDUMP    = $(CROSS_COMPILE)objdump
-
-DISTDIR     ?= $(XEN_ROOT)/dist
-
-INSTALL      = install
-INSTALL_DIR  = $(INSTALL) -d -m0755
-INSTALL_DATA = $(INSTALL) -m0644
-INSTALL_PROG = $(INSTALL) -m0755
-
-ifeq ($(XEN_TARGET_ARCH),x86_64)
-LIBDIR = lib64
-else
-LIBDIR = lib
-endif
-
-ifneq ($(EXTRA_PREFIX),)
-EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
-EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
-endif
-
-LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
-CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
-
-# Choose the best mirror to download linux kernel
-KERNEL_REPO = http://www.kernel.org
-
-# ACM_USE_SECURITY_POLICY is set to security policy of Xen
-# Supported models are:
-#	ACM_NULL_POLICY (ACM will not be built with this policy)
-#	ACM_CHINESE_WALL_POLICY
-#	ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY
-#	ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY
-ACM_USE_SECURITY_POLICY ?= ACM_NULL_POLICY
-
-# Optional components
-XENSTAT_XENTOP ?= y
-
-VTPM_TOOLS ?= n
-
--include $(XEN_ROOT)/.config
+include $(XEN_ROOT)/configs/$(OS).mk
+include $(XEN_ROOT)/configs/common.mk
Makefile +6 -9
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 Makefile
@@ -2,8 +2,12 @@
 # Grand Unified Makefile for Xen.
 #
 
-KERNELS ?= linux-2.6-xen0 linux-2.6-xenU
-# You may use wildcards in the above e.g. KERNELS=*2.6*
+# Default target must appear before any include lines
+all: dist
+
+XEN_ROOT=$(CURDIR)
+include Config.mk
+include buildconfigs/Rules.mk
 
 XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) )
 
@@ -12,13 +16,6 @@
 SUBARCH := $(subst x86_32,i386,$(XEN_TARGET_ARCH))
 export XEN_TARGET_ARCH SUBARCH
 endif
-
-# Default target must appear before any include lines
-all: dist
-
-XEN_ROOT=$(CURDIR)
-include Config.mk
-include buildconfigs/Rules.mk
 
 ifeq ($(XEN_TARGET_X86_PAE),y)
 export pae=y
buildconfigs/Rules.mk +2 -2
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 buildconfigs/Rules.mk
@@ -1,5 +1,5 @@
 
-include Config.mk
+include $(XEN_ROOT)/Config.mk
 
 export DESTDIR
 
@@ -49,7 +49,7 @@
 netbsd-%.tar.bz2: netbsd-%-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2
 	ln -fs $< $@
 
-ifeq ($(OS),linux)
+ifeq ($(KERNEL_OS),linux)
 OS_VER = $(LINUX_VER)
 else
 OS_VER = $(NETBSD_VER)
buildconfigs/mk.linux-2.6-xen +7 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 buildconfigs/mk.linux-2.6-xen
@@ -1,12 +1,14 @@
 
-OS           = linux
+XEN_ROOT = .
+
+KERNEL_OS    = linux
 
 LINUX_SERIES = 2.6
 LINUX_VER    = 2.6.12
 
 EXTRAVERSION ?= xen
 
-LINUX_DIR    = $(OS)-$(LINUX_VER)-$(EXTRAVERSION)
+LINUX_DIR    = $(KERNEL_OS)-$(LINUX_VER)-$(EXTRAVERSION)
 
 include buildconfigs/Rules.mk
 
@@ -20,7 +22,7 @@
 	fi
 	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(DESTDIR) install
 
-$(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)/.valid-ref
+$(LINUX_DIR)/include/linux/autoconf.h: ref-$(KERNEL_OS)-$(LINUX_VER)/.valid-ref
 	rm -rf $(LINUX_DIR)
 	cp -al $(<D) $(LINUX_DIR)
 	# Apply arch-xen patches
@@ -33,7 +35,7 @@
 	  || cp $(LINUX_DIR)/arch/xen/configs/$(EXTRAVERSION)_defconfig_$(XEN_TARGET_ARCH) \
 		$(LINUX_DIR)/.config
 	# See if we need to munge config to enable PAE
-	$(MAKE) CONFIG_FILE=$(LINUX_DIR)/.config -f buildconfigs/Rules.mk config-update-pae
+	$(MAKE) CONFIG_FILE=$(LINUX_DIR)/.config -f buildconfigs/Rules.mk config-update-pae XEN_ROOT=$(XEN_ROOT)
 	# Patch kernel Makefile to set EXTRAVERSION
 	( cd $(LINUX_DIR) ; \
 	  sed -e 's/^EXTRAVERSION.*/&$$(XENGUEST)\nXENGUEST = -$(EXTRAVERSION)/' Makefile >Mk.tmp ; \
@@ -48,4 +50,4 @@
 	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
 
 delete: 
-	rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR) 
+	rm -rf tmp-$(KERNEL_OS)-$(LINUX_VER) $(LINUX_DIR) 
buildconfigs/mk.netbsd-2.0-xenU +6 -4
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 buildconfigs/mk.netbsd-2.0-xenU
@@ -1,3 +1,5 @@
+
+XEN_ROOT = .
 
 OS                = netbsd
 
@@ -8,13 +10,13 @@
 
 FULLVERSION  = $(NETBSD_VER)-$(EXTRAVERSION)
 
-NETBSD_DIR   = $(OS)-$(FULLVERSION)
+NETBSD_DIR   = $(KERNEL_OS)-$(FULLVERSION)
 
 .PHONY: build clean mrproper mkpatch
 
 include buildconfigs/Rules.mk
 
-build: $(OS)-$(EXTRAVERSION)
+build: $(KERNEL_OS)-$(EXTRAVERSION)
 
 netbsd-%-tools.tar.bz2:
 	@echo "Cannot find netbsd-$(NETBSD_VER)-tools.tar.gz in path $(NETBSD_SRC_PATH)"
@@ -24,7 +26,7 @@
 	tar -jxf $<
 	touch $@ # update timestamp to avoid rebuild
 
-$(NETBSD_DIR)/.valid: ref-$(OS)-$(NETBSD_VER)/.valid-ref
+$(NETBSD_DIR)/.valid: ref-$(KERNEL_OS)-$(NETBSD_VER)/.valid-ref
 	$(RM) -rf $(NETBSD_DIR)
 	cp -al $(<D) $(NETBSD_DIR)
 	# Apply arch-xen patches
@@ -42,4 +44,4 @@
 	$(MAKE) -C netbsd-$(FULLVERSION) clean
 
 delete:
-	rm -rf tmp-$(OS)-$(NETBSD_VER) $(NETBSD_DIR)
+	rm -rf tmp-$(KERNEL_OS)-$(NETBSD_VER) $(NETBSD_DIR)
docs/Makefile +2 -3
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 docs/Makefile
@@ -1,8 +1,7 @@
-#!/usr/bin/make -f
+XEN_ROOT = ../
+include $(XEN_ROOT)/Config.mk
 
 VERSION		= xen-unstable
-INSTALL		= install
-INSTALL_DIR	= $(INSTALL) -d -m0755
 
 PS2PDF		:= ps2pdf
 DVIPS		:= dvips
tools/blktap/Makefile +0 -4
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/blktap/Makefile
@@ -10,10 +10,6 @@
 #SUBDIRS += parallax
 
 BLKTAP_INSTALL_DIR = /usr/sbin
-
-INSTALL            = install
-INSTALL_PROG       = $(INSTALL) -m0755
-INSTALL_DIR        = $(INSTALL) -d -m0755
 
 INCLUDES += -I. -I $(XEN_LIBXC) -I $(XEN_XENSTORE)
 
tools/blktap/parallax/Makefile +1 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/blktap/parallax/Makefile
@@ -2,10 +2,6 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
 PARALLAX_INSTALL_DIR	= /usr/sbin
-
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
 
 INCLUDES += -I.. -I/usr/include -I $(XEN_LIBXC)
 
@@ -61,4 +57,4 @@
 	$(CC) $(CFLAGS) -g3 -o $@ [email protected] $(LDFLAGS) $(VDI_SRCS)
 
 .PHONY: TAGS clean install rpm
--include $(DEPS)
\ No newline at end of file
+-include $(DEPS)
tools/blktap/ublkback/Makefile +0 -2
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/blktap/ublkback/Makefile
@@ -4,8 +4,6 @@
 
 INCLUDES += -I..
 
-INSTALL            = install
-INSTALL_PROG = $(INSTALL) -m0755
 IBIN         = ublkback
 INSTALL_DIR  = /usr/sbin
 
tools/console/Makefile +3 -6
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/console/Makefile
@@ -5,10 +5,7 @@
 DAEMON_INSTALL_DIR = /usr/sbin
 CLIENT_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin
 
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
-
+CFLAGS  += $(TOOL_CFLAGS)
 CFLAGS  += -Wall -Werror -g3
 
 CFLAGS  += -I $(XEN_LIBXC)
@@ -24,11 +21,11 @@
 
 xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
 	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
-              -lxenctrl -lxenstore
+              $(SOCKET_LIBS) -lxenctrl -lxenstore
 
 xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
 	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
-	      -lxenctrl -lxenstore
+	      $(SOCKET_LIBS) -lxenctrl -lxenstore
 
 install: $(BIN)
 	$(INSTALL_DIR) -p $(DESTDIR)/$(DAEMON_INSTALL_DIR)
tools/debugger/libxendebug/Makefile +0 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/debugger/libxendebug/Makefile
@@ -1,8 +1,3 @@
-
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DATA	= $(INSTALL) -m0644
-INSTALL_DIR	= $(INSTALL) -d -m0755
 
 MAJOR    = 3.0
 MINOR    = 0
tools/examples/Makefile +0 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/examples/Makefile
@@ -1,10 +1,5 @@
 XEN_ROOT = ../../
 include $(XEN_ROOT)/tools/Rules.mk
-
-INSTALL		= install
-INSTALL_DIR	= $(INSTALL) -d -m0755
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DATA	= $(INSTALL) -m0644
 
 # Init scripts.
 XEND_INITD = init.d/xend
tools/firmware/Makefile +3 -3
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/firmware/Makefile
@@ -4,7 +4,7 @@
 # vmxloader is a 32-bit protected mode binary.
 # It belongs in /usr/lib, not /usr/lib64.
 TARGET      := vmxassist/vmxloader
-INSTALL_DIR := $(DESTDIR)/usr/lib/xen/boot
+TARGET_DIR := $(DESTDIR)/usr/lib/xen/boot
 
 SUBDIRS :=
 SUBDIRS += rombios
@@ -28,8 +28,8 @@
 
 
 install: all
-	[ -d $(INSTALL_DIR) ] || install -d -m0755 $(INSTALL_DIR)
-	[ ! -e $(TARGET) ] || install -m0644 $(TARGET) $(INSTALL_DIR)
+	[ -d $(TARGET_DIR) ] || $(INSTALL_DIR) $(TARGET_DIR)
+	[ ! -e $(TARGET) ] || $(INSTALL_DATA) $(TARGET) $(TARGET_DIR)
 
 clean: 
 	@set -e; for subdir in $(SUBDIRS); do \
tools/libxc/Makefile +3 -7
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/libxc/Makefile
@@ -1,8 +1,3 @@
-
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DATA	= $(INSTALL) -m0644
-INSTALL_DIR	= $(INSTALL) -d -m0755
 
 MAJOR    = 3.0
 MINOR    = 0
@@ -43,6 +38,7 @@
 
 BUILD_SRCS += xg_private.c
 
+CFLAGS   += $(TOOL_CFLAGS)
 CFLAGS   += -Wall
 CFLAGS   += -Werror
 CFLAGS   += -O3
@@ -130,7 +126,7 @@
 	ln -sf $< $@
 
 libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^
 
 # libxenguest
 
@@ -143,6 +139,6 @@
 	ln -sf $< $@
 
 libxenguest.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS) libxenctrl.so
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR) -shared -o $@ $^ -lz -lxenctrl
+	$(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) -shared -o $@ $(PIC_BUILD_OBJS) -lz -lxenctrl
 
 -include $(DEPS)
tools/misc/Makefile +1 -4
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/misc/Makefile
@@ -1,11 +1,8 @@
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DIR	= $(INSTALL) -d -m0755
-
 XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS   += -Wall -Werror -O3 
+CFLAGS   += $(TOOL_CFLAGS)
 
 INCLUDES += -I $(XEN_XC)
 INCLUDES += -I $(XEN_LIBXC)
tools/misc/cpuperf/Makefile +0 -4
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/misc/cpuperf/Makefile
@@ -8,10 +8,6 @@
 # Initial revision
 #
 #
-
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DIR	= $(INSTALL) -d -m0755
 
 # these are for Xen
 XEN_ROOT=../../..
tools/misc/lomount/Makefile +0 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/misc/lomount/Makefile
@@ -1,8 +1,3 @@
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DIR	= $(INSTALL) -d -m0755
-INSTALL_DATA	= $(INSTALL) -m0644
-
 XEN_ROOT=../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
tools/misc/mbootpack/Makefile +0 -4
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/misc/mbootpack/Makefile
@@ -1,10 +1,6 @@
 #
 #  Makefile for mbootpack
 #
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DIR	= $(INSTALL) -d -m0755
-
 XEN_ROOT=../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
tools/misc/miniterm/Makefile +0 -4
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/misc/miniterm/Makefile
@@ -1,7 +1,3 @@
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DIR	= $(INSTALL) -d -m0755
-
 CC     = gcc
 CFLAGS = -Wall -O3
 TARGET = miniterm
tools/python/Makefile +2 -0
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/python/Makefile
@@ -2,6 +2,8 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: all build install clean
+
+CFLAGS += $(TOOL_CFLAGS)
 
 all: build
 build:
tools/vnet/libxutil/Makefile +0 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/vnet/libxutil/Makefile
@@ -2,11 +2,6 @@
 export VNET_ROOT = $(shell cd .. && pwd)
 include $(VNET_ROOT)/Make.env
 endif
-
-INSTALL		= install
-INSTALL_DATA	= $(INSTALL) -m0644
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DIR	= $(INSTALL) -d -m0755
 
 include $(XEN_ROOT)/tools/Rules.mk
 
tools/vtpm/Rules.mk +0 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/vtpm/Rules.mk
@@ -4,11 +4,6 @@
 #
 # Tool definitions
 #
-
-# Installation program and options
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
 
 # Xen tools installation directory
 TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
tools/vtpm_manager/Rules.mk +0 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/vtpm_manager/Rules.mk
@@ -4,11 +4,6 @@
 #
 # Tool definitions
 #
-
-# Installation program and options
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
 
 # Xen tools installation directory
 TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
tools/xcutils/Makefile +0 -4
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/xcutils/Makefile
@@ -7,10 +7,6 @@
 #
 # Copyright (C) 2005 by Christian Limpach
 #
-
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DIR	= $(INSTALL) -d -m0755
 
 XEN_ROOT	= ../..
 include $(XEN_ROOT)/tools/Rules.mk
tools/xenstat/libxenstat/Makefile +1 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/xenstat/libxenstat/Makefile
@@ -14,11 +14,6 @@
 
 XEN_ROOT=../../..
 include $(XEN_ROOT)/tools/Rules.mk
-LINUX_ROOT := $(XEN_ROOT)/linux-2.6-xen-sparse
-
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755 -D
-INSTALL_DATA    = $(INSTALL) -m0644 -D
 
 prefix=/usr
 includedir=$(prefix)/include
@@ -38,6 +33,7 @@
 
 WARN_FLAGS=-Wall -Werror
 
+CFLAGS+=$(TOOL_CFLAGS)
 CFLAGS+=-Isrc -I$(XEN_LIBXC) -I$(XEN_XENSTORE)
 LDFLAGS+=-Lsrc
 
tools/xenstat/xentop/Makefile +3 -7
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/xenstat/xentop/Makefile
@@ -17,10 +17,6 @@
 all install xentop:
 else
 
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755 -D
-INSTALL_DATA    = $(INSTALL) -m0644 -D
-
 prefix=/usr
 mandir=$(prefix)/share/man
 man1dir=$(mandir)/man1
@@ -28,15 +24,15 @@
 
 CFLAGS += -DGCC_PRINTF -Wall -Werror -I$(XEN_LIBXENSTAT)
 LDFLAGS += -L$(XEN_LIBXENSTAT)
-LDLIBS += -lxenstat -lncurses
+LDLIBS += -lxenstat -lncurses $(SOCKET_LIBS)
 
 all: xentop
 
 xentop: xentop.o
 
 install: xentop xentop.1
-	$(INSTALL_PROG) xentop $(DESTDIR)$(sbindir)/xentop
-	$(INSTALL_DATA) xentop.1 $(DESTDIR)$(man1dir)/xentop.1
+	$(INSTALL_PROG) -D xentop $(DESTDIR)$(sbindir)/xentop
+	$(INSTALL_DATA) -D xentop.1 $(DESTDIR)$(man1dir)/xentop.1
 
 endif
 
tools/xenstore/Makefile +5 -9
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/xenstore/Makefile
@@ -2,13 +2,9 @@
 include $(XEN_ROOT)/tools/Rules.mk
 XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
 
-INSTALL         = install
-INSTALL_DATA	= $(INSTALL) -m0644
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
-
 PROFILE=#-pg
 BASECFLAGS=-Wall -g -Werror
+BASECFLAGS += $(TOOL_CFLAGS)
 # Make gcc generate dependencies.
 BASECFLAGS += -Wp,-MD,.$(@F).d
 PROG_DEP = .*.d
@@ -32,16 +28,16 @@
 testcode: xs_test xenstored_test xs_random
 
 xenstored: xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o
-	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
+	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl $(SOCKET_LIBS) -o $@
 
 $(CLIENTS): xenstore-%: xenstore_%.o libxenstore.so
-	$(LINK.o) $< $(LOADLIBES) $(LDLIBS) -lxenctrl -L. -lxenstore -o $@
+	$(LINK.o) $< $(LOADLIBES) $(LDLIBS) -lxenctrl $(SOCKET_LIBS) -L. -lxenstore -o $@
 
 $(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c
 	$(COMPILE.c) -DCLIENT_$(*F) -o $@ $<
 
 xsls: xsls.o libxenstore.so
-	$(LINK.o) $< $(LOADLIBES) $(LDLIBS) -lxenctrl -L. -lxenstore -o $@
+	$(LINK.o) $< $(LOADLIBES) $(LDLIBS) -lxenctrl $(SOCKET_LIBS) -L. -lxenstore -o $@
 
 xenstored_test: xenstored_core_test.o xenstored_watch_test.o xenstored_domain_test.o xenstored_transaction_test.o xs_lib.o talloc_test.o fake_libxc.o utils.o tdb.o
 	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
@@ -72,7 +68,7 @@
 	$(COMPILE.c) -o $@ $<
 
 libxenstore.so: xs.opic xs_lib.opic
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenstore.so -shared -o $@ $^ -lpthread
+	$(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_LDFLAG) -Wl,libxenstore.so -shared -o $@ $^ -lpthread
 
 clean: testsuite-clean
 	rm -f *.o *.opic *.so
tools/xentrace/Makefile +0 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 tools/xentrace/Makefile
@@ -1,8 +1,3 @@
-INSTALL		= install
-INSTALL_PROG	= $(INSTALL) -m0755
-INSTALL_DIR	= $(INSTALL) -d -m0755
-INSTALL_DATA	= $(INSTALL) -m0644
-
 XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
 
xen/Makefile +3 -5
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 xen/Makefile
@@ -1,7 +1,3 @@
-INSTALL			= install
-INSTALL_DATA		= $(INSTALL) -m0644
-INSTALL_DIR		= $(INSTALL) -d -m0755
-
 # This is the correct place to edit the build version.
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 3
@@ -10,6 +6,8 @@
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 
 export BASEDIR          := $(CURDIR)
+
+export XEN_ROOT		:= $(CURDIR)/../
 
 include Rules.mk
 
@@ -137,4 +135,4 @@
 	$(all_sources) > cscope.files
 	cscope -k -b -q
 MAP:
-	$(NM) $(TARGET) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
+	$(NM) $(TARGET) | $(GREP) -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
xen/Rules.mk +3 -3
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 xen/Rules.mk
@@ -42,7 +42,7 @@
 endif
 ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
 
-test-gcc-flag = $(shell $(CC) -v --help 2>&1 | grep -q " $(1) " && echo $(1))
+test-gcc-flag = $(shell $(CC) -v --help 2>&1 | $(GREP) -q " $(1) " && echo $(1))
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
@@ -73,7 +73,7 @@
 CFLAGS := $(strip $(CFLAGS))
 
 %.o: %.c $(HDRS) Makefile
-	$(CC) $(CFLAGS) -c $< -o $@
+	$(CC) $(CFLAGS) $(GCC_ASFLAGS) -c $< -o $@
 
 %.o: %.S $(HDRS) Makefile
-	$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
+	$(CC) $(CFLAGS) $(GCC_ASFLAGS) -D__ASSEMBLY__ -c $< -o $@
configs/Linux.mk new file +34 -0
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 configs/Linux.mk
@@ -0,0 +1,34 @@
+# -*- mode: Makefile; -*-
+
+GREP = grep
+INSTALL = install
+
+AS         = $(CROSS_COMPILE)gas
+LD         = $(CROSS_COMPILE)ld
+CC         = $(CROSS_COMPILE)gcc
+CPP        = $(CROSS_COMPILE)gcc -E
+AR         = $(CROSS_COMPILE)ar
+RANLIB     = $(CROSS_COMPILE)ranlib
+NM         = $(CROSS_COMPILE)nm
+STRIP      = $(CROSS_COMPILE)strip
+OBJCOPY    = $(CROSS_COMPILE)objcopy
+OBJDUMP    = $(CROSS_COMPILE)objdump
+
+XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/)
+
+ifeq ($(XEN_TARGET_ARCH),x86_64)
+LIBDIR = lib64
+else
+LIBDIR = lib
+endif
+SONAME_LDFLAG = -Wl,-soname
+SOCKET_LIBS =
+
+GCC_ASFLAGS =
+TOOL_CFLAGS =
+
+KERNELS ?= linux-2.6-xen0 linux-2.6-xenU
+# You may use wildcards in the above e.g. KERNELS=*2.6*
+
+# Choose the best mirror to download linux kernel
+KERNEL_REPO = http://www.kernel.org
configs/SunOS.mk new file +27 -0
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 configs/SunOS.mk
@@ -0,0 +1,27 @@
+# -*- mode: Makefile; -*-
+
+GREP = ggrep
+INSTALL = ginstall
+
+AS         = $(CROSS_COMPILE)gas
+LD         = $(CROSS_COMPILE)gld
+CC         = $(CROSS_COMPILE)gcc
+CPP        = $(CROSS_COMPILE)gcc -E
+AR         = $(CROSS_COMPILE)gar
+RANLIB     = $(CROSS_COMPILE)granlib
+NM         = $(CROSS_COMPILE)gnm
+STRIP      = $(CROSS_COMPILE)gstrip
+OBJCOPY    = $(CROSS_COMPILE)gobjcopy
+OBJDUMP    = $(CROSS_COMPILE)gobjdump
+
+XEN_COMPILE_ARCH ?= x86_32
+
+LIBDIR = lib
+SOCKET_LIBS = -lsocket
+SONAME_LDFLAG = -Wl,-h 
+
+GCC_ASFLAGS = -Wa,--divide
+TOOL_CFLAGS = -std=gnu99
+
+KERNELS =
+XEN_NO_IOEMU = 1
configs/common.mk new file +38 -0
diff -r d1b5ad8e8b03 -r 31053d3bc7d9 configs/common.mk
@@ -0,0 +1,38 @@
+# -*- mode: Makefile; -*-
+
+XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
+XEN_TARGET_X86_PAE  ?= n
+
+SHELL = /bin/bash
+INSTALL_DIR  = $(INSTALL) -d -m0755
+INSTALL_DATA = $(INSTALL) -m0644
+INSTALL_PROG = $(INSTALL) -m0755
+
+# Tools to run on system hosting the build
+HOSTCC     = gcc
+HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
+
+DISTDIR     ?= $(XEN_ROOT)/dist
+
+ifneq ($(EXTRA_PREFIX),)
+EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
+EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
+endif
+
+LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
+CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
+
+# ACM_USE_SECURITY_POLICY is set to security policy of Xen
+# Supported models are:
+#	ACM_NULL_POLICY (ACM will not be built with this policy)
+#	ACM_CHINESE_WALL_POLICY
+#	ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY
+#	ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY
+ACM_USE_SECURITY_POLICY ?= ACM_NULL_POLICY
+
+# Optional components
+XENSTAT_XENTOP ?= y
+
+VTPM_TOOLS ?= n
+
+-include $(XEN_ROOT)/.config
#1 lore raw
Quoted 7 lines · John Levon

# HG changeset patch
# User [email protected]
# Node ID 31053d3bc7d9d81c682bed791b9d099ada7ff313
# Parent d1b5ad8e8b03b5e79d86d0844b46345a0f931390 Create a configs/ directory for OS-specific makefile settings. Add an initial Solaris config.
Consolidate definitions of INSTALL and friends.

Can you give dome info about the aim of this patch? I would expect that the solaris port will get committed to the opensolaris tree rather than going into our repository as a sparse tree, so it would get built outside our repository and our build environment. So I don't understand why we want a solaris config in our repository.

-- Keir

author
#2 lore raw
Quoted 3 lines · Keir Fraser

Can you give dome info about the aim of this patch? I would expect that the solaris port will get committed to the opensolaris tree rather than going into our repository as a sparse tree

Right.

Quoted 2 lines

outside our repository and our build environment. So I don't understand why we want a solaris config in our repository.

It's about Xen/tools not the kernel port.

This is initial work towards a Solaris Domain 0. For that we most definitely want the tools and Xen itself compiling (and eventually, working) on Solaris. We could maintain this as a permanent fork, but that has all the disadvantages a fork usually does.

regards,
john

#3 lore raw

Re: Solaris dom0 (was "Makefile reworking")

Quoted 4 lines · John Levon

This is initial work towards a Solaris Domain 0. For that we most definitely want the tools and Xen itself compiling (and eventually, working) on Solaris. We could maintain this as a permanent fork, but that has all the disadvantages a fork usually does.

In that case, the mingling of threads and signals in xenstored (see "Make xenstored reopen its trace file on SIGHUP") may not be a good idea. I think that behavior varies across operating systems...

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center