Modifying makefile to look like OE style makefile and moving away from auto-gen makef...
[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 PLATFORM ?=
25 ARCH ?=
26 CROSS_COMPILE ?=
28 #   ----------------------------------------------------------------------------
29 #   Name of the Linux compiler
30 #   ----------------------------------------------------------------------------
31 CC := $(CROSS_COMPILE)gcc
33 #   ----------------------------------------------------------------------------
34 #   General options, sources and libraries
35 #   ----------------------------------------------------------------------------
36 NAME := mem_util
37 SRCS := mem_util.c
38 HDRS := 
39 OBJS :=
40 DEBUG :=
41 BIN := mem_util.elf
43 #   ----------------------------------------------------------------------------
44 #   Compiler and Linker flags for Debug
45 #   ----------------------------------------------------------------------------
46 OBJDIR_D := Debug
47 BINDIR_D := $(OBJDIR_D)
48 LIBS_D := $(LIBS)
49 OBJS_D := $(SRCS:%.c=$(OBJDIR_D)/%.o)
50 ALL_DEBUG := -g3 -gdwarf-2
52 #   ----------------------------------------------------------------------------
53 #   Compiler and Linker flags for Release
54 #   ----------------------------------------------------------------------------
55 OBJDIR_R := Release
56 BINDIR_R := $(OBJDIR_R)
57 LIBS_R := $(LIBS)
58 OBJS_R := $(SRCS:%.c=$(OBJDIR_R)/%.o)
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               -march=armv5te                \
70               -mtune=arm926ej-s             \
71               -c                            \
72               $(CFLAGS)
74 LDFLAGS :=    -march=armv5te                \
75               -mtune=arm926ej-s
77 #   ----------------------------------------------------------------------------
78 #   Compiler symbol definitions 
79 #   ----------------------------------------------------------------------------
80 DEFS :=
82 #   ----------------------------------------------------------------------------
83 #   Compiler and Linker procedure
84 #   From this point and on changes are very unlikely.
85 #   ----------------------------------------------------------------------------
86 .PHONY: all
87 all: debug release
89 #   ----------------------------------------------------------------------------
90 #   Building Debug... 
91 #   ----------------------------------------------------------------------------
92 .PHONY: debug
93 debug: $(BINDIR_D)/$(BIN)
95 $(BINDIR_D)/$(BIN): $(OBJS_D)
96         @echo Compiling Debug...
97         $(CC) -o $@ $(OBJS_D) $(LIBS_D) $(LDFLAGS)  -Wl,-Map,$(BINDIR_D)/$(NAME).map
99 $(OBJDIR_D)/%.o : %.c $(HDRS)
100         $(CC) $(ALL_DEBUG) $(DEFS) $(ALL_CFLAGS) -o$@ $<
102 #   ----------------------------------------------------------------------------
103 #   Building Release... 
104 #   ----------------------------------------------------------------------------
105 .PHONY: release
106 release: $(BINDIR_R)/$(BIN)
108 $(BINDIR_R)/$(BIN): $(OBJS_R)
109         @echo Compiling Release...
110         $(CC) -o $@ $(OBJS_R) $(LIBS_R) $(LDFLAGS) -Wl,-Map,$(BINDIR_R)/$(NAME).map
113 $(OBJDIR_R)/%.o : %.c $(HDRS)
114         $(CC) $(DEFS) $(ALL_CFLAGS) -o$@ $<
116 .PHONY: clean
117 clean:
118         @rm -f $(OBJDIR_D)/*
119         @rm -f $(OBJDIR_R)/*