[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3 of 4] tools: remove pattern matched linking rules



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1301568860 -3600
# Node ID 25e25665f03db5012283e4dc5957d6aa69a30ddf
# Parent  f968b14db03fcd7c42125b2ef9bc28c424959b2a
tools: remove pattern matched linking rules

Most subdirs only build a single tool to start with and those which
build multiple tools often have different linkage requirements.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r f968b14db03f -r 25e25665f03d tools/debugger/xenitp/Makefile
--- a/tools/debugger/xenitp/Makefile    Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/debugger/xenitp/Makefile    Thu Mar 31 11:54:20 2011 +0100
@@ -5,14 +5,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += $(CFLAGS_libxenctrl)
 
-HDRS     = $(wildcard *.h)
-OBJS     = $(patsubst %.c,%.o,$(wildcard *.c))
-
-BIN      =
 LIBBIN   = 
-SCRIPTS  =
-MAN1     = $(wildcard *.1)
-MAN8     = $(wildcard *.8)
 
 ifeq ($(XEN_TARGET_ARCH),ia64)
 LIBBIN  += xenitp
@@ -22,32 +15,18 @@ endif
 all: build
 
 .PHONY: build
-build: $(BIN) $(LIBBIN)
+build: $(LIBBIN)
 
 .PHONY: install
 install: build
-       $(INSTALL_DIR) $(DESTDIR)$(BINDIR)
        [ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
-       $(INSTALL_DIR) $(DESTDIR)$(MAN1DIR)
-       $(INSTALL_DIR) $(DESTDIR)$(MAN8DIR)
-       if [ "x$(SCRIPTS)" != "x" ]; then \
-               $(INSTALL_PROG) $(BIN) $(SCRIPTS) $(DESTDIR)$(BINDIR); \
-       fi
        [ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) 
$(DESTDIR)$(PRIVATE_BINDIR)
-       if [ "x$(MAN1)" != "x" ]; then \
-               $(INSTALL_DATA) $(MAN1) $(DESTDIR)$(MAN1DIR); \
-       fi
-       if [ "x$(MAN1)" != "x" ]; then \
-               $(INSTALL_DATA) $(MAN8) $(DESTDIR)$(MAN8DIR); \
-       fi
 
 .PHONY: clean
 clean:
-       $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN)
-
-%: %.c $(HDRS) Makefile
-       $(CC) $(CFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+       $(RM) *.a *.so *.o *.rpm $(LIBBIN)
 
 XENITP_OBJS=xenitp.o ia64-dis.o ia64-opc.o cpu-ia64-opc.o
+
 xenitp: $(XENITP_OBJS)
        $(CC) $(CFLAGS) -o $@ $(XENITP_OBJS) $(LDLIBS_libxenctrl)
diff -r f968b14db03f -r 25e25665f03d tools/flask/utils/Makefile
--- a/tools/flask/utils/Makefile        Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/flask/utils/Makefile        Thu Mar 31 11:54:20 2011 +0100
@@ -18,7 +18,13 @@ CLIENTS_OBJS := $(patsubst flask-%,%.o,$
 .PHONY: all
 all: $(CLIENTS)
 
-$(CLIENTS): flask-%: %.o
+flask-loadpolicy: loadpolicy.o
+       $(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask 
$(LDLIBS_libxenctrl) -o $@
+
+flask-setenforce: setenforce.o
+       $(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask 
$(LDLIBS_libxenctrl) -o $@
+
+flask-getenforce: getenforce.o
        $(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask 
$(LDLIBS_libxenctrl) -o $@
 
 .PHONY: clean
@@ -41,6 +47,3 @@ install: all
        $(INSTALL_PROG) $(CLIENTS) $(DESTDIR)$(SBINDIR)
 
 -include $(DEPS)
-
-# never delete any intermediate files.
-.SECONDARY:
diff -r f968b14db03f -r 25e25665f03d tools/misc/Makefile
--- a/tools/misc/Makefile       Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/misc/Makefile       Thu Mar 31 11:54:20 2011 +0100
@@ -13,14 +13,6 @@ TARGETS-$(CONFIG_X86) += xen-detect xen-
 TARGETS-$(CONFIG_MIGRATE) += xen-hptool
 TARGETS := $(TARGETS-y)
 
-LDLIBS_xenperf      := $(LDLIBS_libxenctrl)
-LDLIBS_xenpm        := $(LDLIBS_libxenctrl)
-LDLIBS_xenlockprof  := $(LDLIBS_libxenctrl)
-LDLIBS_xenwatchdogd := $(LDLIBS_libxenctrl)
-LDLIBS_xen-hvmctx   := $(LDLIBS_libxenctrl)
-LDLIBS_xen-hvmcrash := $(LDLIBS_libxenctrl)
-LDLIBS_xen-hptool   := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) 
$(LDLIBS_libxenstore)
-
 SUBDIRS-$(CONFIG_LOMOUNT) += lomount
 SUBDIRS-$(CONFIG_MINITERM) += miniterm
 SUBDIRS := $(SUBDIRS-y)
@@ -54,13 +46,31 @@ clean:
        $(RM) *.o $(TARGETS) *~ $(DEPS)
        set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
 
-%.o: %.c $(HDRS) Makefile
-       $(CC) -c $(CFLAGS) -o $@ $<
+xen-hvmctx: xen-hvmctx.o
+       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
 
-xen-hvmctx xen-hvmcrash xenperf xenpm gtracestat xenlockprof xen-hptool 
xenwatchdogd: %: %.o Makefile
-       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_$*)
+xen-hvmcrash: xen-hvmcrash.o
+       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
 
-gtraceview: %: %.o Makefile
+xenperf: xenperf.o
+       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+
+xenpm: xenpm.o
+       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+
+gtracestat: gtracestat.o
+       $(CC) $(LDFLAGS) -o $@ $<
+
+xenlockprof: xenlockprof.o
+       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+
+xen-hptool: xen-hptool.o
+       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) 
$(LDLIBS_libxenstore)
+
+xenwatchdogd: xenwatchdogd.o
+       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+
+gtraceview: gtraceview.o
        $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS)
 
 -include $(DEPS)
diff -r f968b14db03f -r 25e25665f03d tools/misc/lomount/Makefile
--- a/tools/misc/lomount/Makefile       Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/misc/lomount/Makefile       Thu Mar 31 11:54:20 2011 +0100
@@ -3,16 +3,11 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
 
-HDRS     = $(wildcard *.h)
-OBJS     = $(patsubst %.c,%.o,$(wildcard *.c))
-
-BIN      = lomount
-
 .PHONY: all
 all: build
 
 .PHONY: build
-build: $(BIN)
+build: lomount
 
 .PHONY: install
 install install-recurse: build
@@ -22,6 +17,7 @@ install install-recurse: build
 clean:
        $(RM) *.a *.so *.o *.rpm $(BIN)
 
-%: %.c $(HDRS) Makefile
+lomount: lomount.o
        $(CC) $(CFLAGS) -o $@ $< 
 
+-include $(DEPS)
\ No newline at end of file
diff -r f968b14db03f -r 25e25665f03d tools/tests/mce-test/tools/Makefile
--- a/tools/tests/mce-test/tools/Makefile       Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/tests/mce-test/tools/Makefile       Thu Mar 31 11:54:20 2011 +0100
@@ -2,21 +2,20 @@ XEN_ROOT=$(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS += -Werror
-
 CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenguest)
+CFLAGS += $(CFLAGS_libxenstore) 
 CFLAGS += $(CFLAGS_xeninclude) 
 
-HDRS     = $(wildcard *.h)
-
 .PHONY: all
 all: xen-mceinj
 
 install: 
-       cp xen-mceinj /usr/sbin/
+       $(INSTALL_PROG) xen-mceinj $(DESTDIR)$(SBINDIR)
 
 .PHONY: clean
 clean:
        $(RM) *.o xen-mceinj
 
-xen-mceinj: %: %.o Makefile
+xen-mceinj: xen-mceinj.o Makefile
        $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) 
$(LDLIBS_libxenstore)
diff -r f968b14db03f -r 25e25665f03d tools/tests/xen-access/Makefile
--- a/tools/tests/xen-access/Makefile   Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/tests/xen-access/Makefile   Thu Mar 31 11:54:20 2011 +0100
@@ -4,28 +4,24 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 
 CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenguest)
 CFLAGS += $(CFLAGS_xeninclude)
 
 TARGETS-y := 
 TARGETS-$(CONFIG_X86) += xen-access
 TARGETS := $(TARGETS-y)
 
-SUBDIRS-y :=
-SUBDIRS := $(SUBDIRS-y)
-
 .PHONY: all
 all: build
 
 .PHONY: build
 build: $(TARGETS)
-       set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d; done
 
 .PHONY: clean
 clean:
        $(RM) *.o $(TARGETS) *~ $(DEPS)
-       set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
 
-xen-access: %: %.o Makefile
-       $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl)
+xen-access: xen-access.o Makefile
+       $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
 
 -include $(DEPS)
diff -r f968b14db03f -r 25e25665f03d tools/xcutils/Makefile
--- a/tools/xcutils/Makefile    Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/xcutils/Makefile    Thu Mar 31 11:54:20 2011 +0100
@@ -20,19 +20,23 @@ CFLAGS_xc_save.o    := $(CFLAGS_libxenct
 CFLAGS_readnotes.o  := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
 CFLAGS_lsevtchn.o   := $(CFLAGS_libxenctrl)
 
-LDLIBS_xc_restore := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
-LDLIBS_xc_save    := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) 
$(LDLIBS_libxenstore)
-LDLIBS_readnotes  := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
-LDLIBS_lsevtchn   := $(LDLIBS_libxenctrl)
-
 .PHONY: all
 all: build
 
 .PHONY: build
 build: $(PROGRAMS)
 
-$(PROGRAMS): %: %.o
-       $(CC) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_$*) -o $@
+xc_restore: xc_restore.o
+       $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
+
+xc_save: xc_save.o
+       $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) 
$(LDLIBS_libxenstore)
+
+readnotes: readnotes.o
+       $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
+
+lsevtchn: lsevtchn.o
+       $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl)
 
 .PHONY: install
 install: build
diff -r f968b14db03f -r 25e25665f03d tools/xenbackendd/Makefile
--- a/tools/xenbackendd/Makefile        Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/xenbackendd/Makefile        Thu Mar 31 11:54:20 2011 +0100
@@ -17,13 +17,11 @@ CFLAGS  += $(CFLAGS_libxenstore)
 CPPFLAGS += -DXEN_SCRIPT_DIR="\"$(XEN_SCRIPT_DIR)\""
 LDLIBS  += $(LDLIBS_libxenstore)
 
-SBIN = xenbackendd
-
 .PHONY: all
 all: build
 
 .PHONY: build
-build: $(SBIN)
+build: xenbackendd
 
 .PHONY: install
 install: build
@@ -32,10 +30,9 @@ install: build
 
 .PHONY: clean
 clean:
-       rm -f $(SBIN) $(DEPS)
+       rm -f $(DEPS)
 
-
-%: %.o Makefile
+xenbackendd: xenbackendd.o
        $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
 
 -include $(DEPS)
diff -r f968b14db03f -r 25e25665f03d tools/xenmon/Makefile
--- a/tools/xenmon/Makefile     Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/xenmon/Makefile     Thu Mar 31 11:54:20 2011 +0100
@@ -17,14 +17,13 @@ CFLAGS  += -Werror
 CFLAGS  += $(CFLAGS_libxenctrl)
 LDLIBS  += $(LDLIBS_libxenctrl)
 
-BIN = xentrace_setmask xenbaked
 SCRIPTS = xenmon.py
 
 .PHONY: all
 all: build
 
 .PHONY: build
-build: $(BIN)
+build: xentrace_setmask xenbaked
 
 .PHONY: install
 install: build
@@ -37,13 +36,12 @@ install: build
 
 .PHONY: clean
 clean:
-       rm -f $(BIN) $(DEPS)
+       rm -f  $(DEPS)
 
-
-%: %.o Makefile
+xenbaked: xenbaked.o Makefile
        $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
 
-xentrace_%: %.o Makefile
+xentrace_setmask: setmask.o Makefile
        $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
 
 -include $(DEPS)
diff -r f968b14db03f -r 25e25665f03d tools/xenpmd/Makefile
--- a/tools/xenpmd/Makefile     Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/xenpmd/Makefile     Thu Mar 31 11:54:20 2011 +0100
@@ -6,21 +6,19 @@ CFLAGS += $(CFLAGS_libxenstore)
 
 LDLIBS += $(LDLIBS_libxenstore)
 
-BIN      = xenpmd
-
 .PHONY: all
-all: $(BIN)
+all: xenpmd
 
 .PHONY: install
 install: all
        $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
-       $(INSTALL_PROG) $(BIN) $(DESTDIR)$(SBINDIR)
+       $(INSTALL_PROG) xenpmd $(DESTDIR)$(SBINDIR)
 
 .PHONY: clean
 clean:
-       $(RM) -f $(BIN) $(DEPS)
+       $(RM) -f xenpmd $(DEPS)
 
-%: %.o Makefile
+xenpmd: xenpmd.o Makefile
        $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
 
 -include $(DEPS)
diff -r f968b14db03f -r 25e25665f03d tools/xentrace/Makefile
--- a/tools/xentrace/Makefile   Thu Mar 31 11:54:13 2011 +0100
+++ b/tools/xentrace/Makefile   Thu Mar 31 11:54:20 2011 +0100
@@ -6,27 +6,12 @@ CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 LDLIBS += $(LDLIBS_libxenctrl)
 
-HDRS     = $(wildcard *.h)
-OBJS     = $(patsubst %.c,%.o,$(wildcard *.c))
-
 BIN      = xentrace xentrace_setsize
-LIBBIN   = 
+LIBBIN   = xenctx
 SCRIPTS  = xentrace_format
 MAN1     = $(wildcard *.1)
 MAN8     = $(wildcard *.8)
 
-ifeq ($(XEN_TARGET_ARCH),x86_32)
-LIBBIN  += xenctx
-endif
-
-ifeq ($(XEN_TARGET_ARCH),x86_64)
-LIBBIN  += xenctx
-endif
-
-ifeq ($(XEN_TARGET_ARCH),ia64)
-LIBBIN  += xenctx
-endif
-
 .PHONY: all
 all: build
 
@@ -49,9 +34,13 @@ install: build
 clean:
        $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) $(DEPS)
 
-%: %.o $(HDRS) Makefile
+xentrace: xentrace.o
        $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
-xentrace_%: %.o $(HDRS) Makefile
+
+xenctx: xenctx.o
+       $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
+
+xentrace_setsize: setsize.o
        $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
 
 -include $(DEPS)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.