mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
build: add mrproper target
Each time I type `make clean` and find that my tags are cleaned and generated headers/c-files are deleted, I'm getting annoyed. Mostly it's about protobuf images definitions. (And then I need to run `make` and `make tags` again which is painful). I think, we may separate clean process on two parts, just like it's done in the kernel (omitting distclean): o Cleaning all binaries/objects, but leave enough to navigate o Clean everything compiled/generated/etc. In this patch pie blobs are still deleted on clean stage - I may fix it in the later patches. (they _should_ be regenerated on `make clean && make`) Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
19bd013a1e
commit
7e2eee9e3c
25
Makefile
25
Makefile
@ -135,19 +135,25 @@ lib: criu
|
|||||||
all: criu lib
|
all: criu lib
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
clean-built:
|
subclean:
|
||||||
$(Q) $(MAKE) $(build)=images clean
|
$(call msg-clean, criu)
|
||||||
$(Q) $(MAKE) -C criu clean
|
|
||||||
$(Q) $(MAKE) -C lib clean
|
$(Q) $(MAKE) -C lib clean
|
||||||
$(Q) $(MAKE) -C Documentation clean
|
$(Q) $(MAKE) -C Documentation clean
|
||||||
.PHONY: clean-built
|
$(Q) $(RM) .gitid
|
||||||
|
.PHONY: subclean
|
||||||
|
|
||||||
clean: clean-built
|
clean: subclean
|
||||||
$(call msg-clean, criu)
|
$(Q) $(MAKE) $(build)=images $@
|
||||||
|
$(Q) $(MAKE) -C criu $@
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
# mrproper depends on clean in nmk
|
||||||
|
mrproper: subclean
|
||||||
|
$(Q) $(MAKE) $(build)=images $@
|
||||||
|
$(Q) $(MAKE) -C criu $@
|
||||||
$(Q) $(RM) cscope.*
|
$(Q) $(RM) cscope.*
|
||||||
$(Q) $(RM) tags TAGS
|
$(Q) $(RM) tags TAGS
|
||||||
$(Q) $(RM) .gitid
|
.PHONY: mrproper
|
||||||
.PHONY: clean
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Non-CRIU stuff.
|
# Non-CRIU stuff.
|
||||||
@ -224,7 +230,8 @@ help:
|
|||||||
@echo ' docs - Build documentation'
|
@echo ' docs - Build documentation'
|
||||||
@echo ' install - Install binary and man page'
|
@echo ' install - Install binary and man page'
|
||||||
@echo ' dist - Create a source tarball'
|
@echo ' dist - Create a source tarball'
|
||||||
@echo ' clean - Clean everything'
|
@echo ' clean - Clean most, but leave enough to navigate'
|
||||||
|
@echo ' mrproper - Delete all compiled/generated files'
|
||||||
@echo ' tags - Generate tags file (ctags)'
|
@echo ' tags - Generate tags file (ctags)'
|
||||||
@echo ' etags - Generate TAGS file (etags)'
|
@echo ' etags - Generate TAGS file (etags)'
|
||||||
@echo ' cscope - Generate cscope database'
|
@echo ' cscope - Generate cscope database'
|
||||||
|
@ -85,6 +85,7 @@ REQ-DEV-PKG-TEST-NAMES += libcap-dev
|
|||||||
#
|
#
|
||||||
# Make sure all required libs are installed
|
# Make sure all required libs are installed
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
ifneq ($(MAKECMDGOALS),mrproper)
|
||||||
ifneq ($(shell sh -c \
|
ifneq ($(shell sh -c \
|
||||||
'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \
|
'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \
|
||||||
echo "int main(int argc, char *argv[]) { return 0; }" | \
|
echo "int main(int argc, char *argv[]) { return 0; }" | \
|
||||||
@ -100,6 +101,7 @@ ifneq ($(MAKECMDGOALS),clean)
|
|||||||
$(error "Compilation aborted")
|
$(error "Compilation aborted")
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(GMON),1)
|
ifeq ($(GMON),1)
|
||||||
CFLAGS += -pg
|
CFLAGS += -pg
|
||||||
GMONLDOPT := -pg
|
GMONLDOPT := -pg
|
||||||
@ -177,22 +179,36 @@ criu: $(PROGRAM-BUILTINS)
|
|||||||
$(call msg-link, $@)
|
$(call msg-link, $@)
|
||||||
$(Q) $(CC) $(CFLAGS) $^ $(ARCH-LIB) $(LIBS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@
|
$(Q) $(CC) $(CFLAGS) $^ $(ARCH-LIB) $(LIBS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@
|
||||||
|
|
||||||
|
|
||||||
|
subclean:
|
||||||
|
$(Q) $(RM) ./*.{gcda,gcno,gcov}
|
||||||
|
$(Q) $(RM) ./pie/*.{gcda,gcno,gcov}
|
||||||
|
$(Q) $(RM) ./pie/piegen/*.{gcda,gcno,gcov}
|
||||||
|
$(Q) $(RM) -r ./gcov
|
||||||
|
$(Q) $(RM) criu
|
||||||
|
.PHONY: subclean
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cleanup everything.
|
# Clean the most, except generated c files
|
||||||
clean:
|
clean: subclean
|
||||||
|
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) $@
|
||||||
|
$(Q) $(MAKE) $(call build-as,Makefile.library,pie) $@
|
||||||
|
$(Q) $(MAKE) $(call build-as,Makefile.crtools,.) $@
|
||||||
|
$(Q) $(MAKE) $(build)=pie/piegen $@
|
||||||
|
$(Q) $(MAKE) $(build)=pie $@
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
#
|
||||||
|
# Delete all generated files
|
||||||
|
mrproper: subclean
|
||||||
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) $@
|
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) $@
|
||||||
$(Q) $(MAKE) $(call build-as,Makefile.library,pie) $@
|
$(Q) $(MAKE) $(call build-as,Makefile.library,pie) $@
|
||||||
$(Q) $(MAKE) $(call build-as,Makefile.crtools,.) $@
|
$(Q) $(MAKE) $(call build-as,Makefile.crtools,.) $@
|
||||||
$(Q) $(MAKE) $(build)=pie/piegen $@
|
$(Q) $(MAKE) $(build)=pie/piegen $@
|
||||||
$(Q) $(MAKE) $(build)=pie $@
|
$(Q) $(MAKE) $(build)=pie $@
|
||||||
$(Q) $(RM) ./*.{gcda,gcno,gcov}
|
|
||||||
$(Q) $(RM) ./pie/*.{gcda,gcno,gcov}
|
|
||||||
$(Q) $(RM) ./pie/piegen/*.{gcda,gcno,gcov}
|
|
||||||
$(Q) $(RM) -r ./gcov
|
|
||||||
$(Q) $(RM) $(VERSION_HEADER)
|
$(Q) $(RM) $(VERSION_HEADER)
|
||||||
$(Q) $(RM) $(CONFIG_HEADER)
|
$(Q) $(RM) $(CONFIG_HEADER)
|
||||||
$(Q) $(RM) criu
|
.PHONY: mrproper
|
||||||
.PHONY: clean
|
|
||||||
|
|
||||||
UAPI_HEADERS := include/criu-plugin.h include/criu-log.h
|
UAPI_HEADERS := include/criu-plugin.h include/criu-log.h
|
||||||
|
|
||||||
|
@ -89,4 +89,4 @@ protobuf-desc-gen.h: $(PROTOBUF_GEN) include/protobuf-desc.h
|
|||||||
$(call msg-gen, $@)
|
$(call msg-gen, $@)
|
||||||
$(Q) $(SH) $(PROTOBUF_GEN) > $@
|
$(Q) $(SH) $(PROTOBUF_GEN) > $@
|
||||||
|
|
||||||
cleanup-y += protobuf-desc-gen.h
|
mrproper-y += protobuf-desc-gen.h
|
||||||
|
@ -47,6 +47,6 @@ $(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN-TBL) $(obj)/syscalls/$(SYS-DEF)
|
|||||||
|
|
||||||
all-y += $(obj)/$(SYS-EXEC-TBL)
|
all-y += $(obj)/$(SYS-EXEC-TBL)
|
||||||
|
|
||||||
cleanup-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
|
mrproper-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
|
||||||
cleanup-y += $(obj)/$(SYS-CODES)
|
mrproper-y += $(obj)/$(SYS-CODES)
|
||||||
cleanup-y += $(obj)/$(SYS-PROTO)
|
mrproper-y += $(obj)/$(SYS-PROTO)
|
||||||
|
@ -47,6 +47,6 @@ $(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN-TBL) $(obj)/syscalls/$(SYS-DEF)
|
|||||||
|
|
||||||
all-y += $(obj)/$(SYS-EXEC-TBL)
|
all-y += $(obj)/$(SYS-EXEC-TBL)
|
||||||
|
|
||||||
cleanup-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
|
mrproper-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
|
||||||
cleanup-y += $(obj)/$(SYS-CODES)
|
mrproper-y += $(obj)/$(SYS-CODES)
|
||||||
cleanup-y += $(obj)/$(SYS-PROTO)
|
mrproper-y += $(obj)/$(SYS-PROTO)
|
||||||
|
@ -24,7 +24,7 @@ $(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
|
|||||||
'print "\n#ifndef ", $$1, "\n#define", $$1, $$2, "\n#endif";'\
|
'print "\n#ifndef ", $$1, "\n#define", $$1, $$2, "\n#endif";'\
|
||||||
'print "#ifndef ", SYSN, "\n#define ", SYSN, $$1, "\n#endif"}' >> $@
|
'print "#ifndef ", SYSN, "\n#define ", SYSN, $$1, "\n#endif"}' >> $@
|
||||||
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@
|
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@
|
||||||
cleanup-y += $(obj)/$(SYS-CODES)
|
mrproper-y += $(obj)/$(SYS-CODES)
|
||||||
|
|
||||||
$(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF)
|
$(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF)
|
||||||
$(E) " GEN " $@
|
$(E) " GEN " $@
|
||||||
@ -35,7 +35,7 @@ $(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF)
|
|||||||
$(Q) echo "#include \"syscall-types.h\"" >> $@
|
$(Q) echo "#include \"syscall-types.h\"" >> $@
|
||||||
$(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@
|
$(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@
|
||||||
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
|
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
|
||||||
cleanup-y += $(obj)/$(SYS-PROTO)
|
mrproper-y += $(obj)/$(SYS-PROTO)
|
||||||
|
|
||||||
$(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
|
$(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
|
||||||
$(E) " GEN " $@
|
$(E) " GEN " $@
|
||||||
@ -43,12 +43,12 @@ $(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON)
|
|||||||
$(Q) echo "#include \"syscall-codes.h\"" >> $@
|
$(Q) echo "#include \"syscall-codes.h\"" >> $@
|
||||||
$(Q) echo "#include \"syscalls/$(SYS-ASM-COMMON)\"" >> $@
|
$(Q) echo "#include \"syscalls/$(SYS-ASM-COMMON)\"" >> $@
|
||||||
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@
|
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@
|
||||||
cleanup-y += $(obj)/$(SYS-ASM)
|
mrproper-y += $(obj)/$(SYS-ASM)
|
||||||
|
|
||||||
SYS-EXEC-TBL := sys-exec-tbl.c
|
SYS-EXEC-TBL := sys-exec-tbl.c
|
||||||
$(obj)/$(SYS-EXEC-TBL): $(obj)/syscalls/$(SYS-DEF) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
|
$(obj)/$(SYS-EXEC-TBL): $(obj)/syscalls/$(SYS-DEF) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
|
||||||
$(E) " GEN " $@
|
$(E) " GEN " $@
|
||||||
$(Q) echo "/* Autogenerated, don't edit */" > $@
|
$(Q) echo "/* Autogenerated, don't edit */" > $@
|
||||||
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@
|
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@
|
||||||
cleanup-y += $(obj)/$(SYS-EXEC-TBL)
|
mrproper-y += $(obj)/$(SYS-EXEC-TBL)
|
||||||
all-y += $(obj)/$(SYS-EXEC-TBL)
|
all-y += $(obj)/$(SYS-EXEC-TBL)
|
||||||
|
@ -35,7 +35,7 @@ $(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
|
|||||||
'print "\n#ifndef ", $$1, "\n#define", $$1, $$2, "\n#endif";'\
|
'print "\n#ifndef ", $$1, "\n#define", $$1, $$2, "\n#endif";'\
|
||||||
'print "#ifndef ", SYSN, "\n#define ", SYSN, $$1, "\n#endif"}' >> $@
|
'print "#ifndef ", SYSN, "\n#define ", SYSN, $$1, "\n#endif"}' >> $@
|
||||||
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@
|
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@
|
||||||
cleanup-y += $(obj)/$(SYS-CODES)
|
mrproper-y += $(obj)/$(SYS-CODES)
|
||||||
|
|
||||||
$(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF)
|
$(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF)
|
||||||
$(call msg-gen, $@)
|
$(call msg-gen, $@)
|
||||||
@ -52,7 +52,7 @@ ifneq ($(ARCH),x86)
|
|||||||
endif
|
endif
|
||||||
$(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@
|
$(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@
|
||||||
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
|
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
|
||||||
cleanup-y += $(obj)/$(SYS-PROTO)
|
mrproper-y += $(obj)/$(SYS-PROTO)
|
||||||
|
|
||||||
$(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
|
$(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
|
||||||
$(call msg-gen, $@)
|
$(call msg-gen, $@)
|
||||||
@ -60,12 +60,12 @@ $(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON)
|
|||||||
$(Q) echo "#include \"syscall-codes.h\"" >> $@
|
$(Q) echo "#include \"syscall-codes.h\"" >> $@
|
||||||
$(Q) echo "#include \"syscalls/$(SYS-ASM-COMMON)\"" >> $@
|
$(Q) echo "#include \"syscalls/$(SYS-ASM-COMMON)\"" >> $@
|
||||||
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@
|
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@
|
||||||
cleanup-y += $(obj)/$(SYS-ASM)
|
mrproper-y += $(obj)/$(SYS-ASM)
|
||||||
|
|
||||||
SYS-EXEC-TBL := sys-exec-tbl.c
|
SYS-EXEC-TBL := sys-exec-tbl.c
|
||||||
$(obj)/$(SYS-EXEC-TBL): $(obj)/syscalls/$(SYS-DEF) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
|
$(obj)/$(SYS-EXEC-TBL): $(obj)/syscalls/$(SYS-DEF) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
|
||||||
$(call msg-gen, $@)
|
$(call msg-gen, $@)
|
||||||
$(Q) echo "/* Autogenerated, don't edit */" > $@
|
$(Q) echo "/* Autogenerated, don't edit */" > $@
|
||||||
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@
|
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@
|
||||||
cleanup-y += $(obj)/$(SYS-EXEC-TBL)
|
mrproper-y += $(obj)/$(SYS-EXEC-TBL)
|
||||||
all-y += $(obj)/$(SYS-EXEC-TBL)
|
all-y += $(obj)/$(SYS-EXEC-TBL)
|
||||||
|
@ -96,8 +96,10 @@ endif
|
|||||||
$(BLOBS): $(obj)/$(PIELDS)
|
$(BLOBS): $(obj)/$(PIELDS)
|
||||||
all-y += $(BLOBS)
|
all-y += $(BLOBS)
|
||||||
|
|
||||||
|
# blobs and pields are in cleanup, rather than in mrproper because
|
||||||
|
# we want them to be re-generated after `make clean && make`
|
||||||
|
cleanup-y += $(BLOBS)
|
||||||
cleanup-y += $(obj)/$(PIELDS)
|
cleanup-y += $(obj)/$(PIELDS)
|
||||||
cleanup-y += $(obj)/*.bin
|
cleanup-y += $(obj)/*.bin
|
||||||
cleanup-y += $(BLOBS)
|
|
||||||
cleanup-y += $(obj)/*.built-in.bin.o
|
cleanup-y += $(obj)/*.built-in.bin.o
|
||||||
cleanup-y += $(obj)/*.built-in.bin
|
cleanup-y += $(obj)/*.built-in.bin
|
||||||
|
@ -13,5 +13,7 @@ cleanup-y += $(obj)/piegen
|
|||||||
cleanup-y += $(obj)/*.o
|
cleanup-y += $(obj)/*.o
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
ifneq ($(MAKECMDGOALS),mrproper)
|
||||||
incdeps := y
|
incdeps := y
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
@ -102,10 +102,13 @@ $(obj)/built-in.o: $(addprefix $(obj)/,$(proto-obj-y))
|
|||||||
$(Q) $(LD) $(ldflags-y) -r -o $@ $^
|
$(Q) $(LD) $(ldflags-y) -r -o $@ $^
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
ifneq ($(MAKECMDGOALS),mrproper)
|
||||||
-include $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.d))
|
-include $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.d))
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
cleanup-y += $(obj)/*.c.d $(obj)/*.pb-c.c $(obj)/*.pb-c.h
|
mrproper-y += $(obj)/*.pb-c.c $(obj)/*.pb-c.h
|
||||||
|
cleanup-y += $(obj)/*.c.d
|
||||||
cleanup-y += $(obj)/google/protobuf/*.d
|
cleanup-y += $(obj)/google/protobuf/*.d
|
||||||
cleanup-y += $(obj)/google/protobuf/*.h
|
cleanup-y += $(obj)/google/protobuf/*.h
|
||||||
cleanup-y += $(obj)/google/protobuf/*.c
|
cleanup-y += $(obj)/google/protobuf/*.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user