1 |
3 |
sfielding |
#==========================================================================
|
2 |
|
|
# (c) 2003-2008 Total Phase, Inc.
|
3 |
|
|
#--------------------------------------------------------------------------
|
4 |
|
|
# Project : Aardvark Sample Code
|
5 |
|
|
# File : Makefile
|
6 |
|
|
#--------------------------------------------------------------------------
|
7 |
|
|
# Redistribution and use of this file in source and binary forms, with
|
8 |
|
|
# or without modification, are permitted.
|
9 |
|
|
#
|
10 |
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
11 |
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
12 |
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
13 |
|
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
14 |
|
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
15 |
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
16 |
|
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
17 |
|
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
18 |
|
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
19 |
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
20 |
|
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
21 |
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
22 |
|
|
#==========================================================================
|
23 |
|
|
|
24 |
|
|
#==========================================================================
|
25 |
|
|
# CONFIGURATION
|
26 |
|
|
#==========================================================================
|
27 |
|
|
OS=$(shell if [ -x /bin/uname ]; then /bin/uname; fi)
|
28 |
|
|
|
29 |
|
|
ifeq ($(OS),Linux)
|
30 |
|
|
SYSLIBS=-ldl
|
31 |
|
|
endif
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
#==========================================================================
|
35 |
|
|
# CONSTANTS
|
36 |
|
|
#==========================================================================
|
37 |
|
|
OUTDIR=_output
|
38 |
|
|
CC=gcc
|
39 |
|
|
CFLAGS=-Wall -Werror
|
40 |
|
|
LD=$(CC)
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
#==========================================================================
|
44 |
|
|
# TARGETS
|
45 |
|
|
#==========================================================================
|
46 |
|
|
TARGETS= i2cSlaveTest
|
47 |
|
|
|
48 |
|
|
BINARIES=$(TARGETS:%=$(OUTDIR)/%)
|
49 |
|
|
|
50 |
|
|
all : $(OUTDIR) $(BINARIES)
|
51 |
|
|
@if [ -r aardvark.so ]; then cp -f aardvark.so $(OUTDIR); fi
|
52 |
|
|
@if [ -r aardvark.dll ]; then cp -f aardvark.dll $(OUTDIR); fi
|
53 |
|
|
|
54 |
|
|
$(BINARIES) : % : $(OUTDIR)/aardvark.o %.o
|
55 |
|
|
@echo " Linking $@"
|
56 |
|
|
@$(LD) -o $@ $^ $(SYSLIBS)
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
#==========================================================================
|
60 |
|
|
# RULES
|
61 |
|
|
#==========================================================================
|
62 |
|
|
$(OUTDIR)/%.o : %.c
|
63 |
|
|
@echo "+++ Compiling $<"
|
64 |
|
|
@$(CC) $(CFLAGS) -c -o $@ $<
|
65 |
|
|
|
66 |
|
|
$(OUTDIR) :
|
67 |
|
|
@echo "=== Making output directory."
|
68 |
|
|
-@mkdir -p $(OUTDIR)
|
69 |
|
|
|
70 |
|
|
clean:
|
71 |
|
|
@echo "=== Cleaning output directory."
|
72 |
|
|
@rm -fr $(OUTDIR)
|
73 |
|
|
@rm -f MSVC/*.ncb MSVC/*.opt MSVC/*.plg
|
74 |
|
|
@rm -f .bak* *~
|