forked from OSchip/llvm-project
Makefile refactoring for the test suite. Added a make directory under test,
which hosts the Makefile.rules and modified most of the Makefiles under each test case directories to utilize Mekefile.rules. Added a description of 'make' directory into README-TestSuite file. llvm-svn: 111868
This commit is contained in:
parent
dbb71db4cc
commit
9bc867aaf5
|
@ -54,7 +54,12 @@ o subdirectories of 'test'
|
||||||
C/C++/ObjC source files; they were created to house the Python test case which
|
C/C++/ObjC source files; they were created to house the Python test case which
|
||||||
does not involve lldb reading in an executable file at all.
|
does not involve lldb reading in an executable file at all.
|
||||||
|
|
||||||
o unittest2
|
o make directory
|
||||||
|
|
||||||
|
Contains Makefile.rules, which can be utilized by test cases to write Makefile
|
||||||
|
based rules to build native binaries.
|
||||||
|
|
||||||
|
o unittest2 directory
|
||||||
|
|
||||||
Many new features were added to unittest in Python 2.7, including test
|
Many new features were added to unittest in Python 2.7, including test
|
||||||
discovery. unittest2 allows you to use these features with earlier versions of
|
discovery. unittest2 allows you to use these features with earlier versions of
|
||||||
|
|
|
@ -1,125 +1,5 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=main.c
|
|
||||||
CXX_SOURCES :=
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS)
|
|
||||||
OBJECTS =
|
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DSYM) : $(EXE)
|
|
||||||
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
C_SOURCES := main.c
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -1,125 +1,5 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=
|
|
||||||
CXX_SOURCES :=main.cpp
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS)
|
|
||||||
OBJECTS =
|
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DSYM) : $(EXE)
|
|
||||||
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
CXX_SOURCES := main.cpp
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -1,126 +1,7 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=main.c
|
|
||||||
CXX_SOURCES :=
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
C_SOURCES := main.c
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS) -Xlinker -dead_strip
|
LDFLAGS = $(CFLAGS) -Xlinker -dead_strip
|
||||||
OBJECTS =
|
MAKE_DSYM := NO
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Don't make the dSYM so we can test DWARF with debug map...
|
|
||||||
# $(DSYM) : $(EXE)
|
|
||||||
# $(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -1,125 +1,5 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=main.c
|
|
||||||
CXX_SOURCES :=
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS)
|
|
||||||
OBJECTS =
|
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DSYM) : $(EXE)
|
|
||||||
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
C_SOURCES := main.c
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -1,142 +1,8 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=main.c
|
|
||||||
CXX_SOURCES :=
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS)
|
|
||||||
OBJECTS =
|
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# dylib settings
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DYLIB_NAME=a
|
|
||||||
DYLIB_BASENAME=lib$(DYLIB_NAME).dylib
|
|
||||||
DYLIB_C_SOURCES :=a.c
|
|
||||||
ifneq "$(strip $(DYLIB_C_SOURCES))" ""
|
|
||||||
DYLIB_OBJECTS +=$(strip $(DYLIB_C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DSYM) : $(EXE)
|
|
||||||
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS) $(DYLIB_BASENAME)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -L. -l$(DYLIB_NAME) -o "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dylib
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DYLIB_BASENAME) : $(DYLIB_OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -install_name "@executable_path/$(DYLIB_BASENAME)" -dynamiclib -o "$(DYLIB_BASENAME)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(DYLIB_OBJECTS) $(DYLIB_BASENAME) $(DYLIB_BASENAME).dSYM
|
|
||||||
|
|
||||||
|
C_SOURCES := main.c
|
||||||
|
|
||||||
|
DYLIB_NAME := liba.dylib
|
||||||
|
DYLIB_C_SOURCES := a.c
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Clients fill in the source files to build
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# C_SOURCES := main.c
|
||||||
|
# CXX_SOURCES :=
|
||||||
|
# OBJC_SOURCES :=
|
||||||
|
# OBJCXX_SOURCES :=
|
||||||
|
# DYLIB_C_SOURCES :=
|
||||||
|
|
||||||
|
# Uncomment line below for debugging shell commands
|
||||||
|
# SHELL = /bin/sh -x
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Change any build/tool options needed
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
DS := /usr/bin/dsymutil
|
||||||
|
DSFLAGS =
|
||||||
|
CC = gcc
|
||||||
|
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
||||||
|
CPLUSPLUSFLAGS +=$(CFLAGS)
|
||||||
|
CPPFLAGS +=$(CFLAGS)
|
||||||
|
LD = gcc
|
||||||
|
LDFLAGS ?= $(CFLAGS)
|
||||||
|
OBJECTS =
|
||||||
|
EXE = a.out
|
||||||
|
DSYM = $(EXE).dSYM
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# dylib settings
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
ifneq "$(strip $(DYLIB_C_SOURCES))" ""
|
||||||
|
DYLIB_OBJECTS +=$(strip $(DYLIB_C_SOURCES:.c=.o))
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Check if we have any C source files
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
ifneq "$(strip $(C_SOURCES))" ""
|
||||||
|
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
||||||
|
endif
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Check if we have any C++ source files
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
ifneq "$(strip $(CXX_SOURCES))" ""
|
||||||
|
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
||||||
|
LD = g++
|
||||||
|
endif
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Check if we have any ObjC source files
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
ifneq "$(strip $(OBJC_SOURCES))" ""
|
||||||
|
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
||||||
|
LDFLAGS +=-lobjc
|
||||||
|
endif
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Check if we have any ObjC++ source files
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
||||||
|
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
||||||
|
LD = g++
|
||||||
|
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
||||||
|
LDFLAGS +=-lobjc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
ifneq "$(MAKE_DSYM)" "NO"
|
||||||
|
$(DSYM) : $(EXE)
|
||||||
|
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
||||||
|
endif
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Compile the executable from all the objects.
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
ifeq "$(DYLIB_NAME)" ""
|
||||||
|
$(EXE) : $(OBJECTS)
|
||||||
|
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
||||||
|
else
|
||||||
|
$(EXE) : $(OBJECTS) $(DYLIB_NAME)
|
||||||
|
$(LD) $(LDFLAGS) $(OBJECTS) -L. -l$(subst lib,,$(basename $(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)"
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Automatic variables based on items already entered. Below we create
|
||||||
|
# an objects lists from the list of sources by replacing all entries
|
||||||
|
# that end with .c with .o, and we also create a list of prerequisite
|
||||||
|
# files by replacing all .c files with .d.
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
PREREQS := $(OBJECTS:.o=.d)
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Rule for Generating Prerequisites Automatically using .d files and
|
||||||
|
# the compiler -MM option. The -M option will list all system headers,
|
||||||
|
# and the -MM option will list all non-system dependencies.
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
%.d: %.c
|
||||||
|
@set -e; rm -f $@; \
|
||||||
|
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||||
|
rm -f $@.$$$$
|
||||||
|
|
||||||
|
%.d: %.cpp
|
||||||
|
@set -e; rm -f $@; \
|
||||||
|
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||||
|
rm -f $@.$$$$
|
||||||
|
|
||||||
|
%.d: %.m
|
||||||
|
@set -e; rm -f $@; \
|
||||||
|
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||||
|
rm -f $@.$$$$
|
||||||
|
|
||||||
|
%.d: %.mm
|
||||||
|
@set -e; rm -f $@; \
|
||||||
|
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||||
|
rm -f $@.$$$$
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Include all of the makefiles for each source file so we don't have
|
||||||
|
# to manually track all of the prerequisites for each source file.
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
sinclude $(PREREQS)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
dsym: $(DSYM)
|
||||||
|
all: $(EXE) $(DSYM)
|
||||||
|
clean:
|
||||||
|
ifeq "$(DYLIB_NAME)" ""
|
||||||
|
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
||||||
|
else
|
||||||
|
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(DYLIB_OBJECTS) $(DYLIB_NAME) $(DYLIB_NAME).dSYM
|
||||||
|
endif
|
|
@ -1,127 +1,7 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=main.c
|
|
||||||
CXX_SOURCES :=
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
C_SOURCES := main.c
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS) -Xlinker -order_file ./order-file
|
LDFLAGS = $(CFLAGS) -Xlinker -order_file ./order-file
|
||||||
OBJECTS =
|
MAKE_DSYM := NO
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Don't make the dSYM so we can test the DWARF with debug map with
|
|
||||||
# order files
|
|
||||||
#$(DSYM) : $(EXE)
|
|
||||||
# $(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -1,125 +1,5 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=main.c
|
|
||||||
CXX_SOURCES :=
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS)
|
|
||||||
OBJECTS =
|
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DSYM) : $(EXE)
|
|
||||||
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
C_SOURCES := main.c
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -1,125 +1,6 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=
|
|
||||||
CXX_SOURCES :=main.cpp
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -Os
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS)
|
|
||||||
OBJECTS =
|
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DSYM) : $(EXE)
|
|
||||||
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
CXX_SOURCES := main.cpp
|
||||||
|
CFLAGS :=-arch x86_64 -gdwarf-2 -Os
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -1,125 +1,5 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=main.c
|
|
||||||
CXX_SOURCES :=
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS)
|
|
||||||
OBJECTS =
|
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DSYM) : $(EXE)
|
|
||||||
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
C_SOURCES := main.c
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
|
@ -1,125 +1,5 @@
|
||||||
#----------------------------------------------------------------------
|
LEVEL = ../make
|
||||||
# Fill in the source files to build
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
C_SOURCES :=
|
|
||||||
CXX_SOURCES :=main.cpp
|
|
||||||
OBJC_SOURCES :=
|
|
||||||
OBJCXX_SOURCES :=
|
|
||||||
|
|
||||||
# Uncomment line below for debugging shell commands
|
|
||||||
# SHELL = /bin/sh -x
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Change any build/tool options needed
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
DS := /usr/bin/dsymutil
|
|
||||||
DSFLAGS =
|
|
||||||
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
|
|
||||||
CPLUSPLUSFLAGS +=$(CFLAGS)
|
|
||||||
CPPFLAGS +=$(CFLAGS)
|
|
||||||
LD = gcc
|
|
||||||
LDFLAGS = $(CFLAGS)
|
|
||||||
OBJECTS =
|
|
||||||
EXE=a.out
|
|
||||||
DSYM=$(EXE).dSYM
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(C_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(C_SOURCES:.c=.o))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any C++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(CXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
|
|
||||||
LD = g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJC_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Check if we have any ObjC++ source files
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
ifneq "$(strip $(OBJCXX_SOURCES))" ""
|
|
||||||
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
|
|
||||||
LD = g++
|
|
||||||
ifeq $(findstring lobjc,$(LDFLAGS)) ""
|
|
||||||
LDFLAGS +=-lobjc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Make the dSYM file from the executable
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(DSYM) : $(EXE)
|
|
||||||
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Compile the executable from all the objects (default rule) with no
|
|
||||||
# dsym file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
$(EXE) : $(OBJECTS)
|
|
||||||
$(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Automatic variables based on items already entered. Below we create
|
|
||||||
# an objects lists from the list of sources by replacing all entries
|
|
||||||
# that end with .c with .o, and we also create a list of prerequisite
|
|
||||||
# files by replacing all .c files with .d.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
PREREQS := $(OBJECTS:.o=.d)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Rule for Generating Prerequisites Automatically using .d files and
|
|
||||||
# the compiler -MM option. The -M option will list all system headers,
|
|
||||||
# and the -MM option will list all non-system dependencies.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
%.d: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.cpp
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.m
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
%.d: %.mm
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
||||||
rm -f $@.$$$$
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Include all of the makefiles for each source file so we don't have
|
|
||||||
# to manually track all of the prerequisites for each source file.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
sinclude $(PREREQS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
dsym: $(DSYM)
|
|
||||||
all: $(EXE) $(DSYM)
|
|
||||||
clean:
|
|
||||||
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
|
|
||||||
|
|
||||||
|
|
||||||
|
CXX_SOURCES := main.cpp
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
||||||
|
|
Loading…
Reference in New Issue