Commit 25e8cb5c authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

make: Switch main Makefile to simplified form

This is a bit tricky since the build infrastructure
we're switching to is targeted to per-directory targets
if simplified Makefiles are used.

So I did the following

 - move rules to compile general sources to Makefile.crtools
 - main Makefiles now simply calls for scritps/Makefile.build
   help to generate built-in.o target

Also note that we clean up suffixes for implicit rules with

	.SUFFIXES:

this is done on purpose to eliminate any possible side effect
in future -- all rules _must_ be described explicitly.

Because of implicit rules used in zdtm building procedure
I can't use of stict makefile mode and add

	MAKEFLAGS := -r

to the top of the general Makefile. This should be done
one day latter (if ever).
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 3ab787db
# #
# Common definitions # FIXME zdtm building procedure requires implicit rules
# so I can't use strict make file mode and drop completely
# all of implicit rules, so I tuned only .SUFFIXES:
#
# In future zdtm makefiles need to be fixed and the line below
# may be uncommented.
# #
#MAKEFLAGS := -r -R --no-print-directory
#
# Common definitions
#
ifeq ($(strip $(V)),) ifeq ($(strip $(V)),)
E = @echo E = @echo
Q = @ Q = @
...@@ -89,58 +98,16 @@ export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD ...@@ -89,58 +98,16 @@ export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
include scripts/Makefile.version include scripts/Makefile.version
include scripts/Makefile.rules include scripts/Makefile.rules
.SUFFIXES:
# #
# shorthand # shorthand
build := -s -r -R --no-print-directory -f scripts/Makefile.build makefile=Makefile obj build := -r -R --no-print-directory -f scripts/Makefile.build makefile=Makefile obj
build-crtools := -r -R --no-print-directory -f scripts/Makefile.build makefile=Makefile.crtools obj
PROGRAM := crtools PROGRAM := crtools
OBJS += parasite-syscall.o
OBJS += cr-restore.o
OBJS += crtools.o
OBJS += image.o
OBJS += net.o
OBJS += proc_parse.o
OBJS += cr-dump.o
OBJS += cr-show.o
OBJS += cr-check.o
OBJS += util.o
OBJS += sysctl.o
OBJS += ptrace.o
OBJS += kcmp-ids.o
OBJS += rbtree.o
OBJS += log.o
OBJS += libnetlink.o
OBJS += sockets.o
OBJS += sk-inet.o
OBJS += sk-tcp.o
OBJS += sk-unix.o
OBJS += sk-packet.o
OBJS += sk-queue.o
OBJS += files.o
OBJS += files-reg.o
OBJS += pipes.o
OBJS += fifo.o
OBJS += file-ids.o
OBJS += namespaces.o
OBJS += uts_ns.o
OBJS += ipc_ns.o
OBJS += netfilter.o
OBJS += shmem.o
OBJS += eventfd.o
OBJS += eventpoll.o
OBJS += mount.o
OBJS += fsnotify.o
OBJS += signalfd.o
OBJS += pstree.o
OBJS += protobuf.o
OBJS += tty.o
OBJS += cr-exec.o
OBJS += cpu.o
OBJS += file-lock.o
DEPS := $(patsubst %.o,%.d,$(OBJS))
.PHONY: all zdtm test rebuild clean distclean tags cscope \ .PHONY: all zdtm test rebuild clean distclean tags cscope \
docs help pie protobuf arch/$(ARCH) docs help pie protobuf arch/$(ARCH)
...@@ -166,23 +133,12 @@ pie/%:: arch/$(ARCH) ...@@ -166,23 +133,12 @@ pie/%:: arch/$(ARCH)
pie: arch/$(ARCH) pie: arch/$(ARCH)
$(Q) $(MAKE) $(build)=pie all $(Q) $(MAKE) $(build)=pie all
%.o: %.c %.o %.i %.s %.d: $(VERSION_HEADER) pie
$(E) " CC " $@ $(Q) $(MAKE) $(build-crtools)=. $@
$(Q) $(CC) -c $(CFLAGS) $< -o $@ built-in.o: $(VERSION_HEADER) pie
$(Q) $(MAKE) $(build-crtools)=. $@
%.i: %.c
$(E) " CC " $@
$(Q) $(CC) -E $(CFLAGS) $< -o $@
%.s: %.c $(PROGRAM): $(SYSCALL-LIB) $(ARCH-LIB) pie/util-net.o protobuf/built-in.o built-in.o
$(E) " CC " $@
$(Q) $(CC) -S $(CFLAGS) -fverbose-asm $< -o $@
%.d: %.c
$(E) " DEP " $@
$(Q) $(CC) -M -MT $@ -MT $(patsubst %.d,%.o,$@) $(CFLAGS) $< -o $@
$(PROGRAM): $(SYSCALL-LIB) $(ARCH-LIB) pie/util-net.o protobuf/built-in.o $(OBJS)
$(E) " LINK " $@ $(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $^ $(LIBS) -o $@ $(Q) $(CC) $(CFLAGS) $^ $(LIBS) -o $@
...@@ -206,9 +162,7 @@ clean: ...@@ -206,9 +162,7 @@ clean:
$(Q) $(MAKE) $(build)=arch/$(ARCH) clean $(Q) $(MAKE) $(build)=arch/$(ARCH) clean
$(Q) $(MAKE) $(build)=protobuf clean $(Q) $(MAKE) $(build)=protobuf clean
$(Q) $(MAKE) $(build)=pie clean $(Q) $(MAKE) $(build)=pie clean
$(Q) $(RM) ./*.o $(Q) $(MAKE) $(build-crtools)=. clean
$(Q) $(RM) ./*.d
$(Q) $(RM) ./*.i
$(Q) $(RM) ./*.img $(Q) $(RM) ./*.img
$(Q) $(RM) ./*.out $(Q) $(RM) ./*.out
$(Q) $(RM) ./*.bin $(Q) $(RM) ./*.bin
...@@ -264,14 +218,4 @@ gcov: ...@@ -264,14 +218,4 @@ gcov:
lcov -a crtools.l.info -a crtools.ns.info -o crtools.info && \ lcov -a crtools.l.info -a crtools.ns.info -o crtools.info && \
genhtml -o html crtools.info genhtml -o html crtools.info
deps-targets := $(OBJS) $(patsubst %.o,%.s,$(OBJS)) $(patsubst %.o,%.i,$(OBJS)) $(PROGRAM)
.DEFAULT_GOAL := all .DEFAULT_GOAL := all
ifneq ($(filter $(deps-targets), $(MAKECMDGOALS)),)
INCDEPS := 1
endif
ifeq ($(INCDEPS),1)
-include $(DEPS)
endif
obj-y += parasite-syscall.o
obj-y += cr-restore.o
obj-y += crtools.o
obj-y += image.o
obj-y += net.o
obj-y += proc_parse.o
obj-y += cr-dump.o
obj-y += cr-show.o
obj-y += cr-check.o
obj-y += util.o
obj-y += sysctl.o
obj-y += ptrace.o
obj-y += kcmp-ids.o
obj-y += rbtree.o
obj-y += log.o
obj-y += libnetlink.o
obj-y += sockets.o
obj-y += sk-inet.o
obj-y += sk-tcp.o
obj-y += sk-unix.o
obj-y += sk-packet.o
obj-y += sk-queue.o
obj-y += files.o
obj-y += files-reg.o
obj-y += pipes.o
obj-y += fifo.o
obj-y += file-ids.o
obj-y += namespaces.o
obj-y += uts_ns.o
obj-y += ipc_ns.o
obj-y += netfilter.o
obj-y += shmem.o
obj-y += eventfd.o
obj-y += eventpoll.o
obj-y += mount.o
obj-y += fsnotify.o
obj-y += signalfd.o
obj-y += pstree.o
obj-y += protobuf.o
obj-y += tty.o
obj-y += cr-exec.o
obj-y += cpu.o
obj-y += file-lock.o
ifneq ($(MAKECMDGOALS),clean)
incdeps := y
endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment