[Lldb-commits] [lldb] r242813 - Update TestLoadUnload to use base Makefile.
Chaoren Lin
chaorenl at google.com
Tue Jul 21 10:50:16 PDT 2015
Author: chaoren
Date: Tue Jul 21 12:50:16 2015
New Revision: 242813
URL: http://llvm.org/viewvc/llvm-project?rev=242813&view=rev
Log:
Update TestLoadUnload to use base Makefile.
Summary:
The current Makefile scheme only allows one dylib to be specified in each make
invocation, so TestLoadUnload had a custom Makefile that's unrelated to the
base Makefile.rules. This change uses recursive make invocations to bypass the
single dylib restriction. See D11202 for more context.
Reviewers: clayborg
Subscribers: chaoren, lldb-commits
Differential Revision: http://reviews.llvm.org/D11367
Added:
lldb/trunk/test/functionalities/load_unload/a.mk
lldb/trunk/test/functionalities/load_unload/b.mk
lldb/trunk/test/functionalities/load_unload/c.mk
lldb/trunk/test/functionalities/load_unload/d.mk
lldb/trunk/test/functionalities/load_unload/hidden/Makefile
lldb/trunk/test/functionalities/load_unload/hidden/d.c
- copied, changed from r242783, lldb/trunk/test/functionalities/load_unload/d.c
Removed:
lldb/trunk/test/functionalities/load_unload/hidden/.keep
Modified:
lldb/trunk/test/functionalities/load_unload/Makefile
lldb/trunk/test/functionalities/load_unload/d.c
lldb/trunk/test/make/Makefile.rules
Modified: lldb/trunk/test/functionalities/load_unload/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/Makefile?rev=242813&r1=242812&r2=242813&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/Makefile (original)
+++ lldb/trunk/test/functionalities/load_unload/Makefile Tue Jul 21 12:50:16 2015
@@ -1,84 +1,24 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
- ARCH = x86_64
-endif
-
-ifeq "$(OS)" ""
- OS = $(shell uname -s)
-endif
-
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
-
-LIB_PREFIX := libloadunload_
-
-ifeq "$(OS)" "Darwin"
- CFLAGS += -arch $(ARCH)
- DS := dsymutil
- LD_FLAGS := -dynamiclib
- LIB_A := $(LIB_PREFIX)a.dylib
- LIB_B := $(LIB_PREFIX)b.dylib
- LIB_C := $(LIB_PREFIX)c.dylib
- LIB_D := $(LIB_PREFIX)d.dylib
- EXEC_PATH := "@executable_path"
- EXEC_PATH_A := -install_name $(EXEC_PATH)/$(LIB_A)
- EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
- EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
- EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
-
- DS_IF_DARWIN = $(DS) -o $@.dSYM $@
-else
- CFLAGS += -fPIC
- LD_FLAGS := -shared
- LIB_DL := -ldl
- LIB_A := $(LIB_PREFIX)a.so
- LIB_B := $(LIB_PREFIX)b.so
- LIB_C := $(LIB_PREFIX)c.so
- LIB_D := $(LIB_PREFIX)d.so
-endif
-
-all: a.out $(LIB_A) $(LIB_B) $(LIB_C) $(LIB_D) hidden/$(LIB_D)
-
-a.out: main.o $(LIB_D)
- $(CC) $(CFLAGS) -o a.out main.o -L. -pie -lloadunload_d $(LIB_DL)
-
-main.o: main.c
- $(CC) $(CFLAGS) -c main.c
-
-hidden/$(LIB_D): dh.o
- $(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
- $(DS_IF_DARWIN)
-
-$(LIB_A): a.o $(LIB_B)
- $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. -lloadunload_b
- $(DS_IF_DARWIN)
-
-a.o: a.c
- $(CC) $(CFLAGS) -c a.c
-
-$(LIB_B): b.o
- $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
- $(DS_IF_DARWIN)
-
-b.o: b.c
- $(CC) $(CFLAGS) -c b.c
-
-$(LIB_C): c.o
- $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
- $(DS_IF_DARWIN)
-
-c.o: c.c
- $(CC) $(CFLAGS) -c c.c
-
-$(LIB_D): d.o
- $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
- $(DS_IF_DARWIN)
+LEVEL := ../../make
-d.o: d.c
- $(CC) $(CFLAGS) -c d.c
+LIB_PREFIX := loadunload_
-dh.o: d.c
- $(CC) $(CFLAGS) -DHIDDEN -c d.c -o dh.o
+LD_EXTRAS := -L. -l$(LIB_PREFIX)d -ldl
+C_SOURCES := main.c
-clean:
- rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM hidden/*)
+include $(LEVEL)/Makefile.rules
+
+.PHONY:
+a.out: lib_a lib_b lib_c lib_d hidden_lib_d
+
+lib_%:
+ $(MAKE) -f $*.mk
+
+hidden_lib_d:
+ $(MAKE) -C hidden
+
+clean::
+ $(MAKE) -f a.mk clean
+ $(MAKE) -f b.mk clean
+ $(MAKE) -f c.mk clean
+ $(MAKE) -f d.mk clean
+ $(MAKE) -C hidden clean
Added: lldb/trunk/test/functionalities/load_unload/a.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/a.mk?rev=242813&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/a.mk (added)
+++ lldb/trunk/test/functionalities/load_unload/a.mk Tue Jul 21 12:50:16 2015
@@ -0,0 +1,21 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+CFLAGS_EXTRAS := -fPIC
+LD_EXTRAS := -L. -l$(LIB_PREFIX)b
+
+DYLIB_NAME := $(LIB_PREFIX)a
+DYLIB_C_SOURCES := a.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
+
+.PHONY:
+$(DYLIB_FILENAME): lib_b
+
+lib_b:
+ $(MAKE) -f b.mk
+
+clean::
+ $(MAKE) -f b.mk clean
Added: lldb/trunk/test/functionalities/load_unload/b.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/b.mk?rev=242813&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/b.mk (added)
+++ lldb/trunk/test/functionalities/load_unload/b.mk Tue Jul 21 12:50:16 2015
@@ -0,0 +1,9 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+DYLIB_NAME := $(LIB_PREFIX)b
+DYLIB_C_SOURCES := b.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/functionalities/load_unload/c.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/c.mk?rev=242813&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/c.mk (added)
+++ lldb/trunk/test/functionalities/load_unload/c.mk Tue Jul 21 12:50:16 2015
@@ -0,0 +1,9 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+DYLIB_NAME := $(LIB_PREFIX)c
+DYLIB_C_SOURCES := c.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/test/functionalities/load_unload/d.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/d.c?rev=242813&r1=242812&r2=242813&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/d.c (original)
+++ lldb/trunk/test/functionalities/load_unload/d.c Tue Jul 21 12:50:16 2015
@@ -9,9 +9,5 @@
int
d_function ()
{ // Find this line number within d_dunction().
-#ifdef HIDDEN
- return 12345;
-#else
return 700;
-#endif
}
Added: lldb/trunk/test/functionalities/load_unload/d.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/d.mk?rev=242813&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/d.mk (added)
+++ lldb/trunk/test/functionalities/load_unload/d.mk Tue Jul 21 12:50:16 2015
@@ -0,0 +1,11 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+DYLIB_EXECUTABLE_PATH := $(CURDIR)
+
+DYLIB_NAME := $(LIB_PREFIX)d
+DYLIB_C_SOURCES := d.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/functionalities/load_unload/hidden/.keep
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/hidden/.keep?rev=242812&view=auto
==============================================================================
(empty)
Added: lldb/trunk/test/functionalities/load_unload/hidden/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/hidden/Makefile?rev=242813&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/hidden/Makefile (added)
+++ lldb/trunk/test/functionalities/load_unload/hidden/Makefile Tue Jul 21 12:50:16 2015
@@ -0,0 +1,9 @@
+LEVEL := ../../../make
+
+LIB_PREFIX := loadunload_
+
+DYLIB_NAME := $(LIB_PREFIX)d
+DYLIB_C_SOURCES := d.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Copied: lldb/trunk/test/functionalities/load_unload/hidden/d.c (from r242783, lldb/trunk/test/functionalities/load_unload/d.c)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/hidden/d.c?p2=lldb/trunk/test/functionalities/load_unload/hidden/d.c&p1=lldb/trunk/test/functionalities/load_unload/d.c&r1=242783&r2=242813&rev=242813&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/d.c (original)
+++ lldb/trunk/test/functionalities/load_unload/hidden/d.c Tue Jul 21 12:50:16 2015
@@ -9,9 +9,5 @@
int
d_function ()
{ // Find this line number within d_dunction().
-#ifdef HIDDEN
return 12345;
-#else
- return 700;
-#endif
}
Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=242813&r1=242812&r2=242813&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Tue Jul 21 12:50:16 2015
@@ -200,6 +200,7 @@ EXE ?= a.out
ifneq "$(DYLIB_NAME)" ""
ifeq "$(OS)" "Darwin"
DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
+ DYLIB_EXECUTABLE_PATH ?= @executable_path
else ifeq "$(OS)" "Windows_NT"
DYLIB_FILENAME = $(DYLIB_NAME).dll
else
@@ -452,7 +453,7 @@ $(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING
$(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
ifeq "$(OS)" "Darwin"
- $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "@executable_path/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
+ $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "$(DYLIB_EXECUTABLE_PATH)/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
ifneq "$(MAKE_DSYM)" "NO"
ifneq "$(DS)" ""
"$(DS)" $(DSFLAGS) "$(DYLIB_FILENAME)"
More information about the lldb-commits
mailing list