tools/console: have one Makefile per program/directory

Sources of both xenconsoled and xenconsole are already separated into
different directory and don't share anything in common. Having two
different Makefile means it's easier to deal with *FLAGS.

Some common changes:
Rename $(BIN) to $(TARGETS), this will be useful later.
Stop removing *.so *.rpm *.a as they aren't created here.
Use $(OBJS-y) to list objects.
Update $(CFLAGS) for the directory rather than a single object.

daemon:
    Remove the need for $(LDLIBS_xenconsoled), use $(LDLIBS) instead.
    Remove the need for $(CONSOLE_CFLAGS-y) and use $(CFLAGS-y)
	instead.

client:
    Remove the unused $(LDLIBS_xenconsole)

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
This commit is contained in:
Anthony PERARD authored and Jan Beulich committed 2022-07-11 12:13:07 +02:00
1 parent 796dae0fe4
commit 524cf4da66
6 files changed
+94 -48

No files matched your search

-2
View File
@@ -160,8 +160,6 @@ tools/libs/util/libxenutil.map
tools/libs/vchan/headers.chk tools/libs/vchan/headers.chk
tools/libs/vchan/libxenvchan.map tools/libs/vchan/libxenvchan.map
tools/libs/vchan/xenvchan.pc tools/libs/vchan/xenvchan.pc
tools/console/xenconsole
tools/console/xenconsoled
tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/* tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
tools/debugger/gdb/gdb-6.2.1/* tools/debugger/gdb/gdb-6.2.1/*
tools/debugger/gdb/gdb-6.2.1.tar.bz2 tools/debugger/gdb/gdb-6.2.1.tar.bz2
+3 -46
View File
@@ -1,50 +1,7 @@
XEN_ROOT=$(CURDIR)/../.. XEN_ROOT=$(CURDIR)/../..
include $(XEN_ROOT)/tools/Rules.mk include $(XEN_ROOT)/tools/Rules.mk
CFLAGS += -Werror SUBDIRS-y := daemon client
CFLAGS += $(CFLAGS_libxenctrl) .PHONY: all clean install distclean uninstall
CFLAGS += $(CFLAGS_libxenstore) all clean install distclean uninstall: %: subdirs-%
LDLIBS += $(LDLIBS_libxenctrl)
LDLIBS += $(LDLIBS_libxenstore)
LDLIBS += $(SOCKET_LIBS)
LDLIBS_xenconsoled += $(UTIL_LIBS)
LDLIBS_xenconsoled += -lrt
CONSOLE_CFLAGS-$(CONFIG_ARM) = -DCONFIG_ARM
BIN = xenconsoled xenconsole
.PHONY: all
all: $(BIN)
.PHONY: clean
clean:
$(RM) *.a *.so *.o *.rpm $(BIN) $(DEPS_RM)
$(RM) client/*.o daemon/*.o
.PHONY: distclean
distclean: clean
daemon/main.o: CFLAGS += -include $(XEN_ROOT)/tools/config.h
daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) $(CFLAGS_libxenforeignmemory) $(CONSOLE_CFLAGS-y)
xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_libxenforeignmemory) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS)
client/main.o: CFLAGS += -include $(XEN_ROOT)/tools/config.h
xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole) $(APPEND_LDFLAGS)
.PHONY: install
install: $(BIN)
$(INSTALL_DIR) $(DESTDIR)/$(sbindir)
$(INSTALL_PROG) xenconsoled $(DESTDIR)/$(sbindir)
$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
$(INSTALL_PROG) xenconsole $(DESTDIR)$(LIBEXEC_BIN)
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(LIBEXEC_BIN)/xenconsole
rm -f $(DESTDIR)$(sbindir)/xenconsoled
-include $(DEPS_INCLUDE)
+1
View File
@@ -0,0 +1 @@
/xenconsole
+39
View File
@@ -0,0 +1,39 @@
XEN_ROOT=$(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
CFLAGS += -Werror
CFLAGS += $(CFLAGS_libxenctrl)
CFLAGS += $(CFLAGS_libxenstore)
CFLAGS += -include $(XEN_ROOT)/tools/config.h
LDLIBS += $(LDLIBS_libxenctrl)
LDLIBS += $(LDLIBS_libxenstore)
LDLIBS += $(SOCKET_LIBS)
OBJS-y := main.o
TARGETS := xenconsole
.PHONY: all
all: $(TARGETS)
xenconsole: $(OBJS-y)
$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
.PHONY: install
install: all
$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
$(INSTALL_PROG) xenconsole $(DESTDIR)$(LIBEXEC_BIN)
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(LIBEXEC_BIN)/xenconsole
.PHONY: clean
clean:
$(RM) *.o $(TARGETS) $(DEPS_RM)
.PHONY: distclean
distclean: clean
-include $(DEPS_INCLUDE)
+1
View File
@@ -0,0 +1 @@
/xenconsoled
+50
View File
@@ -0,0 +1,50 @@
XEN_ROOT=$(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
CFLAGS += -Werror
CFLAGS += $(CFLAGS_libxenctrl)
CFLAGS += $(CFLAGS_libxenstore)
CFLAGS += $(CFLAGS_libxenevtchn)
CFLAGS += $(CFLAGS_libxengnttab)
CFLAGS += $(CFLAGS_libxenforeignmemory)
CFLAGS-$(CONFIG_ARM) += -DCONFIG_ARM
CFLAGS += -include $(XEN_ROOT)/tools/config.h
LDLIBS += $(LDLIBS_libxenctrl)
LDLIBS += $(LDLIBS_libxenstore)
LDLIBS += $(LDLIBS_libxenevtchn)
LDLIBS += $(LDLIBS_libxengnttab)
LDLIBS += $(LDLIBS_libxenforeignmemory)
LDLIBS += $(SOCKET_LIBS)
LDLIBS += $(UTIL_LIBS)
LDLIBS += -lrt
OBJS-y := main.o
OBJS-y += io.o
OBJS-y += utils.o
TARGETS := xenconsoled
.PHONY: all
all: $(TARGETS)
xenconsoled: $(OBJS-y)
$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
.PHONY: install
install: all
$(INSTALL_DIR) $(DESTDIR)/$(sbindir)
$(INSTALL_PROG) xenconsoled $(DESTDIR)/$(sbindir)
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(sbindir)/xenconsoled
.PHONY: clean
clean:
$(RM) *.o $(TARGETS) $(DEPS_RM)
.PHONY: distclean
distclean: clean
-include $(DEPS_INCLUDE)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.