File: Makefile.debug

package info (click to toggle)
dmtcp 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,496 kB
  • sloc: cpp: 33,592; ansic: 28,099; sh: 6,735; makefile: 1,950; perl: 1,690; python: 1,241; asm: 138; java: 13
file content (112 lines) | stat: -rw-r--r-- 4,013 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# This Makefile.mtcp is for standalone debugging of the mtcp directory.
#   Copy this to GNUmakefile, if you want this to take precedence for debugging.
# Use the Makefile generated by Makefile.in to build full DMTCP and install.

CC=gcc
# Uncomment the next line if you are testing multi-arch mode (32- and 64-bits.)
# M32=1

ifeq ($(M32),1)
  CFLAGS_M32 = -m32 -march=i386 -Wa,--32
endif


# We need to integrate HOST_IS_ARM and HOST_IS_ARM64
HOST_IS_ARM=${shell uname -m | grep '^arm' | sed -e 's^\(...\).*^\1^'}
ifeq ($(HOST_IS_ARM),arm)
  ARM_EXTRAS = syscall-arm.S
  ARM_BINARIES = syscall-arm.o
  CFLAGS += -DMTCP_SYS_ERRNO_ON_STACK
endif

HOST_IS_AARCH64=${shell uname -m | grep '^aarch64'}
ifeq ($(HOST_IS_AARCH64),aarch64)
  ARM_EXTRAS = syscall-aarch64.S
  ARM_BINARIES = syscall-aarch64.o
  CFLAGS += -DMTCP_SYS_ERRNO_ON_STACK
endif

all: ../../bin/mtcp_restart libmtcp.a ../../lib/dmtcp/libdmtcp.so

../../lib/dmtcp/libdmtcp.so: libmtcp.a
	cd ../..; make -j8

# ../../bin/mtcp_restart: mtcp_restart.o mtcp_check_vdso.o
../../bin/mtcp_restart: mtcp_restart.o ${ARM_BINARIES}
	${CC} ${CFLAGS_M32} -fPIC -g -O2 -nodefaultlibs -o $@ $^

# IMPORTANT:  Compile with -O2 or higher.  On some 32-bit CPUs
#   (e.g. ARM/gcc-4.8), the inlining of -O2 avoids bugs when fnc's are copied.
mtcp_restart.o: mtcp_restart.c mtcp_util.ic mtcp_check_vdso.ic \
	        mtcp_sys.h mtcp_util.h \
	        ../membarrier.h ../../include/procmapsarea.h
	${CC} ${CFLAGS} ${CFLAGS_M32} ${MTCP_CFLAGS} -I. -I../../include \
	    -DPIC -fPIC -g -O0 -fno-stack-protector -c $<

# Not used.  Convenience target for debugging.
mtcp_restart.s: mtcp_restart.c mtcp_util.ic mtcp_check_vdso.ic \
	        mtcp_sys.h mtcp_util.h \
	        ../membarrier.h ../../include/procmapsarea.h
	${CC} ${CFLAGS} ${MTCP_CFLAGS} -I. -I../../include \
	    -DPIC -fPIC -g -O0 -fno-stack-protector -S $<

# procmapssrea.h taken from mtcp_util.h ; Is this necessary?
mtcp_check_vdso.o: mtcp_check_vdso.ic mtcp_sys.h mtcp_util.h \
	../../include/procmapsarea.h
	${CC} ${MTCP_CFLAGS} -I. -I../../include -DPIC -fPIC -g -O2 -c $<

# Try 'make gdb' before 'make check' if you want debugging information
#   available in the case of 'make check' dumping core.
check: ../../bin/mtcp_restart ckpt_dmtcp1_test.dmtcp
	@echo 'Expected result: "Error 99" (MTCP transfered to DMTCP correctly)'
	../../bin/mtcp_restart \
	  --text-offset `./text_offset.sh ../../bin/mtcp_restart` \
	  ckpt_dmtcp1_test.dmtcp

gdb: build_mtcp_restart_debug ../../lib/dmtcp/libdmtcp.so gdb_run
build_mtcp_restart_debug:
	rm -f mtcp_restart.o
	${MAKE} -f ${lastword ${MAKEFILE_LIST}} MTCP_CFLAGS=-DDEBUG \
	  mtcp_restart.o
gdb_run: ../../bin/mtcp_restart ckpt_dmtcp1_test.dmtcp
	gdb --args ../../bin/mtcp_restart \
	  --use-gdb --text-offset `./text_offset.sh ../../bin/mtcp_restart` \
	  ckpt_dmtcp1_test.dmtcp
ckpt_dmtcp1_test.dmtcp: ../../test/dmtcp1 restore_libc.o
	../../bin/dmtcp_launch -i3 ../../test/dmtcp1 &
	sleep 8 && ../../bin/dmtcp_command --quit
	rm -f `ls -t dmtcp_restart_script*.sh`
	mv `ls -t ckpt_dmtcp1_*.dmtcp | head -1` ckpt_dmtcp1_test.dmtcp.gz
	gunzip ckpt_dmtcp1_test.dmtcp.gz

libmtcp.a: restore_libc.o ${ARM_BINARIES}
	ar cru $@ $^
# FIXME:  This is a low-level file.  Yet it draws from two directories.
#    Part of the problem is that restore_libc.h copies DPRINTF from mtcp_util.h
#    and uses protectedfds.h, which is in ../../include
#    Do we really need protectedfds.h for low-level, where there is no JASSERT?
restore_libc.o: restore_libc.c
	$(CC) ${CFLAGS} ${MTCP_CFLAGS} -DPIC -fPIC -fno-stack-protector \
	  -g -O0 -I. -I../../include -c $<
syscall-arm.o: syscall-arm.S
	${CC} ${CFLAGS} -c $<
syscall-aarch64.o: syscall-aarch64.S
	${CC} ${CFLAGS} -c $<

tidy:
	rm -rf ckpt_*_files
	rm -f ckpt_*.dmtcp dmtcp_restart_script* core*

clean: tidy
	-rm -f *.o
	-rm -f $(targetdir)/bin/mtcp_restart

install:

uninstall:

distclean:

dist: clean
	dir=`basename $$PWD`; cd ..; tar zcvf $$dir.tar.gz ./$$dir
	dir=`basename $$PWD`; ls -l ../$$dir.tar.gz