[Lldb-commits] [lldb] r133456 - in /lldb/trunk/test: global_variables/Makefile make/Makefile.rules
Peter Collingbourne
peter at pcc.me.uk
Mon Jun 20 12:06:04 PDT 2011
Author: pcc
Date: Mon Jun 20 14:06:04 2011
New Revision: 133456
URL: http://llvm.org/viewvc/llvm-project?rev=133456&view=rev
Log:
Add Linux rules to test makefile
Modified:
lldb/trunk/test/global_variables/Makefile
lldb/trunk/test/make/Makefile.rules
Modified: lldb/trunk/test/global_variables/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/global_variables/Makefile?rev=133456&r1=133455&r2=133456&view=diff
==============================================================================
--- lldb/trunk/test/global_variables/Makefile (original)
+++ lldb/trunk/test/global_variables/Makefile Mon Jun 20 14:06:04 2011
@@ -2,7 +2,7 @@
C_SOURCES := main.c
-DYLIB_NAME := liba.dylib
+DYLIB_NAME := a
DYLIB_C_SOURCES := a.c
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=133456&r1=133455&r2=133456&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Mon Jun 20 14:06:04 2011
@@ -12,11 +12,16 @@
#----------------------------------------------------------------------
# If ARCH is not defined, default to x86_64.
+# If OS is not defined, use 'uname -s' to determine the OS name.
#----------------------------------------------------------------------
ifeq "$(ARCH)" ""
ARCH = x86_64
endif
+ifeq "$(OS)" ""
+ OS = $(shell uname -s)
+endif
+
#----------------------------------------------------------------------
# CC defaults to gcc.
# See also these functions:
@@ -31,15 +36,27 @@
#----------------------------------------------------------------------
# Change any build/tool options needed
#----------------------------------------------------------------------
-DS := /usr/bin/dsymutil
-DSFLAGS =
-CFLAGS ?=-arch $(ARCH) -gdwarf-2 -O0
+CFLAGS ?= -gdwarf-2 -O0
CXXFLAGS +=$(CFLAGS)
LD = $(CC)
LDFLAGS ?= $(CFLAGS)
OBJECTS =
EXE ?= a.out
-DSYM = $(EXE).dSYM
+
+ifeq "$(OS)" "Darwin"
+ CFLAGS += -arch $(ARCH)
+ DS := /usr/bin/dsymutil
+ DSFLAGS =
+ DSYM = $(EXE).dSYM
+endif
+
+ifneq "$(DYLIB_NAME)" ""
+ ifeq "$(OS)" "Darwin"
+ DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
+ else
+ DYLIB_FILENAME = lib$(DYLIB_NAME).so
+ endif
+endif
# Function that returns the counterpart C++ compiler, given $(CC) as arg.
cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
@@ -95,9 +112,11 @@
#----------------------------------------------------------------------
# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
#----------------------------------------------------------------------
-ifneq "$(MAKE_DSYM)" "NO"
+ifeq "$(OS)" "Darwin"
+ ifneq "$(MAKE_DSYM)" "NO"
$(DSYM) : $(EXE)
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
+ endif
endif
#----------------------------------------------------------------------
@@ -107,15 +126,19 @@
$(EXE) : $(OBJECTS)
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
else
-$(EXE) : $(OBJECTS) $(DYLIB_NAME)
- $(LD) $(LDFLAGS) $(OBJECTS) -L. -l$(subst lib,,$(basename $(DYLIB_NAME))) -o "$(EXE)"
+$(EXE) : $(OBJECTS) $(DYLIB_FILENAME)
+ $(LD) $(LDFLAGS) $(OBJECTS) -L. -l$(DYLIB_NAME) -o "$(EXE)"
endif
#----------------------------------------------------------------------
# Make the dylib
#----------------------------------------------------------------------
-$(DYLIB_NAME) : $(DYLIB_OBJECTS)
- $(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -install_name "@executable_path/$(DYLIB_NAME)" -dynamiclib -o "$(DYLIB_NAME)"
+$(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
+ifeq "$(OS)" "Darwin"
+ $(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -install_name "@executable_path/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
+else
+ $(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -shared -o "$(DYLIB_FILENAME)"
+endif
#----------------------------------------------------------------------
# Automatic variables based on items already entered. Below we create
@@ -173,7 +196,7 @@
ifeq "$(DYLIB_NAME)" ""
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
else
- rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(DYLIB_OBJECTS) $(DYLIB_NAME) $(DYLIB_NAME).dSYM
+ rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(DYLIB_OBJECTS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).dSYM
endif
#----------------------------------------------------------------------
More information about the lldb-commits
mailing list