]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/am_sysinfo.git/blob - mem_util/makefile
am_sysinfo: Allow CFLAGS to be overridden.
[apps/am_sysinfo.git] / mem_util / makefile
1 #   ----------------------------------------------------------------------------
2 #  @file   Makefile
3 #
4 #  @path   
5 #
6 #  @desc   Makefile for mem_util (Debug and Release versions)
7 #
8 #  @ver    1.10
9 #   ----------------------------------------------------------------------------
10 #  Copyright (c) Texas Instruments Incorporated 2002-2009
11 #
12 #  Use of this software is controlled by the terms and conditions found in the
13 #  license agreement under which this software has been supplied or provided.
14 #
16 #   ----------------------------------------------------------------------------
17 #   Included defined variables
18 #   ----------------------------------------------------------------------------
19 -include ../../../Rules.make
21 #   ----------------------------------------------------------------------------
22 #   Variables passed in externally
23 #   ----------------------------------------------------------------------------
24 CFLAGS ?= -march=armv5te -mtune=arm926ej-s
25 CROSS_COMPILE ?=
27 #   ----------------------------------------------------------------------------
28 #   Name of the Linux compiler
29 #   ----------------------------------------------------------------------------
30 CC := $(CROSS_COMPILE)gcc
32 #   ----------------------------------------------------------------------------
33 #   General options, sources and libraries
34 #   ----------------------------------------------------------------------------
35 NAME := mem_util
36 SRCS := mem_util.c
37 HDRS := 
38 OBJS :=
39 DEBUG :=
40 BIN := mem_util
42 #   ----------------------------------------------------------------------------
43 #   Compiler and Linker flags for Debug
44 #   ----------------------------------------------------------------------------
45 OBJDIR_D := Debug
46 BINDIR_D := $(OBJDIR_D)
47 LIBS_D := $(LIBS)
48 OBJS_D := $(SRCS:%.c=$(OBJDIR_D)/%.o)
49 ALL_DEBUG := -g3 -gdwarf-2
51 #   ----------------------------------------------------------------------------
52 #   Compiler and Linker flags for Release
53 #   ----------------------------------------------------------------------------
54 OBJDIR_R := Release
55 BINDIR_R := $(OBJDIR_R)
56 LIBS_R := $(LIBS)
57 OBJS_R := $(SRCS:%.c=$(OBJDIR_R)/%.o)
58 ALL_RELEASE :=
60 #   ----------------------------------------------------------------------------
61 #   Compiler include directories 
62 #   ----------------------------------------------------------------------------
63 INCLUDES := 
65 #   ----------------------------------------------------------------------------
66 #   All compiler options to be passed to the command line
67 #   ----------------------------------------------------------------------------
68 ALL_CFLAGS := $(INCLUDES)                   \
69               -c                            \
70               $(CFLAGS)
72 LDFLAGS :=
74 #   ----------------------------------------------------------------------------
75 #   Compiler symbol definitions 
76 #   ----------------------------------------------------------------------------
77 DEFS :=
79 #   ----------------------------------------------------------------------------
80 #   Compiler and Linker procedure
81 #   From this point and on changes are very unlikely.
82 #   ----------------------------------------------------------------------------
83 .PHONY: all
84 all: debug release
86 #   ----------------------------------------------------------------------------
87 #   Building Debug... 
88 #   ----------------------------------------------------------------------------
89 .PHONY: debug
90 debug: $(BINDIR_D)/$(BIN)
92 $(BINDIR_D)/$(BIN): $(OBJS_D)
93         @echo Compiling Debug...
94         $(CC) -o $@ $(OBJS_D) $(LIBS_D) $(LDFLAGS)  -Wl,-Map,$(BINDIR_D)/$(NAME).map
96 $(OBJDIR_D)/%.o : %.c $(HDRS)
97         @mkdir -p $(OBJDIR_D)
98         $(CC) $(ALL_DEBUG) $(DEFS) $(ALL_CFLAGS) -o$@ $<
100 #   ----------------------------------------------------------------------------
101 #   Building Release... 
102 #   ----------------------------------------------------------------------------
103 .PHONY: release
104 release: $(BINDIR_R)/$(BIN)
106 $(BINDIR_R)/$(BIN): $(OBJS_R)
107         @echo Compiling Release...
108         $(CC) -o $@ $(OBJS_R) $(LIBS_R) $(LDFLAGS) -Wl,-Map,$(BINDIR_R)/$(NAME).map
111 $(OBJDIR_R)/%.o : %.c $(HDRS)
112         @mkdir -p $(OBJDIR_R)
113         $(CC) $(DEFS) $(ALL_RELEASE) $(ALL_CFLAGS) -o$@ $<
115 .PHONY: clean
116 clean:
117         @rm -rf $(OBJDIR_D)
118         @rm -rf $(OBJDIR_R)