mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
test/zdtm: unify common code
This commit expands the success with lib/Makefile to the rest of ztdm/Makefiles. In particular, it moves the common part to Makefile.inc and let {lib,static,transition}/Makefile use it. This results in: - dependencies being handled properly; - reduction of makefiles length due to unification; - possibly more proper dependencies and builds. While at it, let's also: - make rules for criu-rtc.so silent; - set default CC=gcc; - remove duplicate -m32 from CFLAGS. Signed-off-by: Kir Kolyshkin <kir@openvz.org> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
4dcceffe43
commit
50d7991168
1
test/zdtm/.gitignore
vendored
1
test/zdtm/.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
/lib/libzdtmtst.a
|
||||
/lib/.gitignore
|
||||
/static/.gitignore
|
||||
/transition/.gitignore
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
MAKEFLAGS += -r
|
||||
|
||||
ARCH ?= $(shell uname -m | sed \
|
||||
-e s/i.86/x86/ \
|
||||
-e s/x86_64/x86/ \
|
||||
@ -18,6 +20,9 @@ endif
|
||||
|
||||
SRCARCH ?= $(ARCH)
|
||||
|
||||
CC := gcc
|
||||
CFLAGS += -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
|
||||
CFLAGS += $(USERCFLAGS)
|
||||
CPPFLAGS += -iquote $(LIBDIR)/arch/$(SRCARCH)/include
|
||||
|
||||
ifeq ($(strip $(V)),)
|
||||
@ -32,10 +37,57 @@ RM := rm -f --one-file-system
|
||||
|
||||
ifeq ($(COMPAT_TEST),y)
|
||||
ifeq ($(ARCH),x86)
|
||||
export USERCFLAGS += -m32
|
||||
export CFLAGS += -m32
|
||||
export LDFLAGS += -m32
|
||||
endif
|
||||
endif
|
||||
|
||||
export E Q RM
|
||||
DEPEND.c = $(COMPILE.c) -MM -MP
|
||||
%.d: %.c
|
||||
$(E) " DEP " $*.d
|
||||
$(Q)$(DEPEND.c) $(OUTPUT_OPTION) $<
|
||||
|
||||
%.o: %.c | %.d
|
||||
$(E) " CC " $@
|
||||
$(Q)$(COMPILE.c) $(OUTPUT_OPTION) $<
|
||||
|
||||
%: %.o $(LDLIBS)
|
||||
@echo $@ >> .gitignore
|
||||
$(E) " LINK " $@
|
||||
$(Q)$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
|
||||
|
||||
default: all
|
||||
.PHONY: default
|
||||
|
||||
gitignore-clean:
|
||||
$(RM) .gitignore
|
||||
.PHONY: gitignore-clean
|
||||
|
||||
clean: gitignore-clean
|
||||
$(RM) $(OBJ) $(TST) *~
|
||||
.PHONY: clean
|
||||
|
||||
cleandep: clean
|
||||
$(RM) $(DEP)
|
||||
.PHONY: cleandep
|
||||
|
||||
cleanout:
|
||||
$(RM) -r *.pid *.out* *.test* *.state
|
||||
.PHONY: cleanout
|
||||
|
||||
%.cleanout: %
|
||||
$(Q) $(RM) -r $<.pid* $<.out* *$<.test* $<.*.test $<.*.state $<.state chew_$<.test*
|
||||
|
||||
realclean: cleandep cleanout
|
||||
.PHONY: realclean
|
||||
|
||||
dep: $(DEP)
|
||||
.PHONY: dep
|
||||
|
||||
no-deps-targets := clean cleandep cleanout realclean groups.cleanout
|
||||
|
||||
ifeq ($(filter $(no-deps-targets), $(MAKECMDGOALS)),)
|
||||
-include $(DEP)
|
||||
endif
|
||||
|
||||
.SECONDARY:
|
||||
|
@ -1,8 +1,5 @@
|
||||
MAKEFLAGS += -r
|
||||
LIBDIR := .
|
||||
include ../Makefile.inc
|
||||
|
||||
CFLAGS := -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
|
||||
CFLAGS += $(USERCFLAGS)
|
||||
|
||||
LIB := libzdtmtst.a
|
||||
@ -18,43 +15,16 @@ LDLIBS := $(LIB)
|
||||
|
||||
TARGETS := $(LIB) $(BIN)
|
||||
|
||||
include ../Makefile.inc
|
||||
|
||||
all: $(TARGETS)
|
||||
.PHONY: all
|
||||
|
||||
DEPEND.c = $(COMPILE.c) -MM -MP
|
||||
%.d: %.c
|
||||
$(E) " DEP " $*.d
|
||||
$(Q)$(DEPEND.c) $(OUTPUT_OPTION) $<
|
||||
|
||||
%.o: %.c | %.d
|
||||
$(E) " CC " $@
|
||||
$(Q)$(COMPILE.c) $(OUTPUT_OPTION) $<
|
||||
|
||||
%: %.o $(LDLIBS)
|
||||
$(E) " LINK " $@
|
||||
$(Q)$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
|
||||
clean-more:
|
||||
$(RM) $(TARGETS)
|
||||
.PHONY: clean-more
|
||||
clean: clean-more
|
||||
|
||||
$(LIB): $(LIBOBJ)
|
||||
$(E) " AR " $@
|
||||
$(Q)ar rcs $@ $^
|
||||
|
||||
dep: $(DEP)
|
||||
.PHONY: dep
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJ) $(TARGETS)
|
||||
|
||||
cleandep: clean
|
||||
$(RM) $(DEP)
|
||||
|
||||
cleanout: clean ;
|
||||
|
||||
realclean: clean cleandep
|
||||
|
||||
.PHONY: clean cleandep cleanout realclean
|
||||
|
||||
no-deps-targets := clean cleandep cleanout realclean
|
||||
|
||||
ifeq ($(filter $(no-deps-targets), $(MAKECMDGOALS)),)
|
||||
-include $(DEP)
|
||||
endif
|
||||
|
@ -1,12 +1,7 @@
|
||||
include ../Makefile.inc
|
||||
.SUFFIXES: # No implicit rules
|
||||
|
||||
LIBDIR = ../lib
|
||||
LIB = $(LIBDIR)/libzdtmtst.a
|
||||
LDLIBS += $(LIBDIR)/libzdtmtst.a
|
||||
LIBDIR := ../lib
|
||||
LIB := $(LIBDIR)/libzdtmtst.a
|
||||
LDLIBS += $(LIB)
|
||||
CPPFLAGS += -I$(LIBDIR)
|
||||
CFLAGS = -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
|
||||
CFLAGS += $(USERCFLAGS)
|
||||
|
||||
TST_NOFILE := \
|
||||
busyloop00 \
|
||||
@ -314,15 +309,7 @@ OUT = $(TST:%=%.out)
|
||||
STATE = $(TST_STATE:%=%.state)
|
||||
STATE_OUT = $(TST_STATE:%=%.out)
|
||||
|
||||
%.o: %.c
|
||||
@echo $@ >> .gitignore
|
||||
$(E) " CC " $@
|
||||
$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
%: %.o
|
||||
@echo $@ >> .gitignore
|
||||
$(E) " LINK " $@
|
||||
$(Q)$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
|
||||
include ../Makefile.inc
|
||||
|
||||
all: $(TST) criu-rtc.so
|
||||
install: all
|
||||
@ -449,7 +436,9 @@ stopped01: CFLAGS += -DZDTM_STOPPED_KILL
|
||||
stopped02: CFLAGS += -DZDTM_STOPPED_TKILL
|
||||
stopped12: CFLAGS += -DZDTM_STOPPED_KILL -DZDTM_STOPPED_TKILL
|
||||
clone_fs: LDLIBS += -pthread
|
||||
netns_sub_veth: CFLAGS += -I/usr/include/libnl3
|
||||
# As generating dependencies won't work without proper includes,
|
||||
# we have to explicitly specify both .o and .d for this case:
|
||||
netns_sub_veth.o netns_sub_veth.d: CPPFLAGS += -I/usr/include/libnl3
|
||||
netns_sub_veth: LDLIBS += -lnl-3 -l nl-route-3
|
||||
|
||||
socket-tcp-fin-wait1: CFLAGS += -D ZDTM_TCP_FIN_WAIT1
|
||||
@ -468,31 +457,21 @@ pty-console: CFLAGS += -D ZDTM_DEV_CONSOLE
|
||||
$(LIB): force
|
||||
$(Q) $(MAKE) -C $(LIBDIR)
|
||||
|
||||
gitignore-clean:
|
||||
$(RM) -f .gitignore
|
||||
|
||||
clean: gitignore-clean
|
||||
$(RM) -f $(OBJ) $(TST) *~ criu-rtc.so criu-rtc.pb-c.c criu-rtc.pb-c.h get_smaps_bits.o
|
||||
|
||||
cleandep: clean
|
||||
$(RM) -f $(DEP)
|
||||
|
||||
cleanout:
|
||||
$(RM) -f -r *.pid *.out* *.test* *.state
|
||||
|
||||
%.cleanout: %
|
||||
$(Q) $(RM) -f -r $<.pid* $<.out* *$<.test* $<.*.test $<.*.state $<.state
|
||||
|
||||
realclean: cleandep cleanout
|
||||
clean-more:
|
||||
$(RM) criu-rtc.so criu-rtc.pb-c.c criu-rtc.pb-c.h get_smaps_bits.o
|
||||
.PHONY: clean-more
|
||||
clean: clean-more
|
||||
|
||||
rtc.c: criu-rtc.so
|
||||
|
||||
criu-rtc.pb-c.c: criu-rtc.proto
|
||||
$(Q)echo $@ >> .gitignore
|
||||
$(Q)echo $(@:%.c=%.h) >> .gitignore
|
||||
protoc-c --proto_path=. --c_out=. criu-rtc.proto
|
||||
$(E) " PBCC " $@
|
||||
$(Q)protoc-c --proto_path=. --c_out=. criu-rtc.proto
|
||||
|
||||
criu-rtc.so: criu-rtc.c criu-rtc.pb-c.c
|
||||
$(CC) -g -Wall -shared -nostartfiles criu-rtc.c criu-rtc.pb-c.c -o criu-rtc.so -iquote ../../../criu/include -fPIC $(filter-out -m32,$(USERCFLAGS))
|
||||
$(E) " LD " $@
|
||||
$(Q)$(CC) -g -Wall -shared -nostartfiles criu-rtc.c criu-rtc.pb-c.c -o criu-rtc.so -iquote ../../../criu/include -fPIC $(filter-out -m32,$(USERCFLAGS))
|
||||
|
||||
.PHONY: force clean cleandep cleanout realclean start check_start stop wait_stop
|
||||
.PHONY: force start check_start stop wait_stop
|
||||
|
@ -1,12 +1,7 @@
|
||||
include ../Makefile.inc
|
||||
.SUFFIXES: # No implicit rules
|
||||
|
||||
LIBDIR = ../lib
|
||||
LIB = $(LIBDIR)/libzdtmtst.a
|
||||
LDLIBS += $(LIBDIR)/libzdtmtst.a
|
||||
LIBDIR := ../lib
|
||||
LIB := $(LIBDIR)/libzdtmtst.a
|
||||
LDLIBS += $(LIB)
|
||||
CPPFLAGS += -I$(LIBDIR)
|
||||
CFLAGS = -g -O2 -Wall -Werror -fno-strict-aliasing
|
||||
CFLAGS += $(USERCFLAGS)
|
||||
|
||||
TST_NOFILE = \
|
||||
ipc \
|
||||
@ -41,15 +36,7 @@ DEP = $(SRC:%.c=%.d)
|
||||
PID = $(TST:%=%.pid)
|
||||
OUT = $(TST:%=%.out)
|
||||
|
||||
%.o: %.c
|
||||
@echo $@ >> .gitignore
|
||||
$(E) " CC " $@
|
||||
$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
%: %.o
|
||||
@echo $@ >> .gitignore
|
||||
$(E) " LINK " $@
|
||||
$(Q)$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
|
||||
include ../Makefile.inc
|
||||
|
||||
all: $(TST)
|
||||
install: all
|
||||
@ -99,21 +86,4 @@ thread-bomb: LDFLAGS += -pthread
|
||||
$(LIB): force
|
||||
$(Q) $(MAKE) -C $(LIBDIR)
|
||||
|
||||
gitignore-clean:
|
||||
$(RM) -f .gitignore
|
||||
|
||||
clean: gitignore-clean
|
||||
$(RM) -f $(OBJ) $(TST) *~
|
||||
|
||||
cleandep: clean
|
||||
$(RM) -f $(DEP)
|
||||
|
||||
%.cleanout: %
|
||||
$(Q) $(RM) -f -r $<.pid* $<.out* $<.test* chew_$<.test*
|
||||
|
||||
cleanout:
|
||||
$(RM) -f *.pid *.out* *.test chew*
|
||||
|
||||
realclean: cleandep cleanout
|
||||
|
||||
.PHONY: force clean cleandep cleanout realclean start check_start stop wait_stop
|
||||
.PHONY: force start check_start stop wait_stop
|
||||
|
Loading…
x
Reference in New Issue
Block a user