nmenon / omap-u-boot-utils

U-Boot Utilities for Texas Instrument's OMAP platforms

This URL has Read+Write access

omap-u-boot-utils / makefile
100644 167 lines (137 sloc) 4.345 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#
# Make file for compiling host app
#
# (C) Copyright 2008
# Texas Instruments, <www.ti.com>
# Nishanth Menon <nm@ti.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation version 2.
#
# This program is distributed .as is. WITHOUT ANY WARRANTY of any kind,
# whether express or implied; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
 
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
sed -e "s/\(cygwin\).*/cygwin/")
srctree := $(if $(SRC),$(SRC),$(CURDIR))
 
ifeq ($(HOSTOS),windowsnt)
WINDOWS=1
endif
 
ifeq ($(HOSTOS),windows32)
WINDOWS=1
endif
 
# Windows Specific handling
ifdef WINDOWS
EXE_PREFIX=.exe
#Installation System specific
ifndef COMPILER_PREFIX
COMPILER_PREFIX=C:\\MinGW\\bin\\
endif
ifndef APP_PREFIX
APP_PREFIX=C:\\GnuWin32\\bin\\
endif
endif #windows
 
# Selective Library
ifdef WINDOWS
LIB_FILES=lib/serial_win32.c lib/file_win32.c
else
LIB_FILES=lib/serial_posix.c lib/file_posix.c
endif
LIB_FILES+=lib/f_status.c lib/lcfg/lcfg_static.c
 
#App source code
PSERIAL_FILES=src/pserial.c
KERMIT_FILES=src/ukermit.c
UCMD_FILES=src/ucmd.c
PUSB_FILES=src/pusb.c
GPSIGN_FILES=src/gpsign.c
 
DOCS=docs/html docs/latex
 
# Final output files
PSERIAL_EXE=pserial$(EXE_PREFIX)
KERMIT_EXE=ukermit$(EXE_PREFIX)
UCMD_EXE=ucmd$(EXE_PREFIX)
PUSB_EXE=pusb$(EXE_PREFIX)
GPSIGN_EXE=gpsign$(EXE_PREFIX)
 
# Object Files
PSERIAL_OBJ=$(PSERIAL_FILES:.c=.o)
KERMIT_OBJ=$(KERMIT_FILES:.c=.o)
UCMD_OBJ=$(UCMD_FILES:.c=.o)
PUSB_OBJ=$(PUSB_FILES:.c=.o)
GPSIGN_OBJ=$(GPSIGN_FILES:.c=.o)
 
LIB_OBJ=$(LIB_FILES:.c=.o)
 
CLEANUPFILES=$(PSERIAL_OBJ) $(LIB_OBJ) $(PSERIAL_EXE) $(GWART_OBJ)\
$(KERMIT_EXE) $(KERMIT_OBJ) $(UCMD_OBJ) $(UCMD_EXE)\
$(PUSB_EXE) $(PUSB_OBJ) $(GPSIGN_EXE) $(GPSIGN_OBJ)
 
CC=$(COMPILER_PREFIX)gcc
LD=$(COMPILER_PREFIX)gcc
RM=$(APP_PREFIX)rm$(EXE_PREFIX)
ECHO=$(APP_PREFIX)echo$(EXE_PREFIX)
DOXYGEN=$(APP_PREFIX)doxygen$(EXE_PREFIX)
 
CFLAGS=-Wall -O3 -Iinclude -Ilib/lcfg
LDFLAGS=
 
CFLAGS+=-fdata-sections -ffunction-sections
LDFLAGS+=--gc-sections --print-gc-sections --stdlib
LDFLAGS_USB=-lusb
 
ifdef DISABLE_COLOR
CFLAGS+=-DDISABLE_COLOR
endif
 
ifdef V
    VERBOSE = $(V)
endif
ifndef VERBOSE
  VERBOSE = 0
endif
 
 
%.o: %.c
@$(ECHO) "Compiling: " $<
$(if $(VERBOSE:1=),@)$(CC) $(CFLAGS) -o $@ -c $<
 
.PHONY : all
 
all: $(PSERIAL_EXE) $(KERMIT_EXE) $(UCMD_EXE) $(GPSIGN_EXE)
 
usb: $(PUSB_EXE)
 
$(PSERIAL_EXE): $(PSERIAL_OBJ) $(LIB_OBJ) makefile
@$(ECHO) "Generating: $@"
$(if $(VERBOSE:1=),@)$(LD) $(PSERIAL_OBJ) $(LIB_OBJ) $(LDFLAGS) -o $@
@$(ECHO)
 
$(KERMIT_EXE): $(KERMIT_OBJ) $(LIB_OBJ) makefile
@$(ECHO) "Generating: $@"
$(if $(VERBOSE:1=),@)$(LD) $(KERMIT_OBJ) $(LIB_OBJ) $(LDFLAGS) -o $@
@$(ECHO)
 
$(UCMD_EXE): $(UCMD_OBJ) $(LIB_OBJ) makefile
@$(ECHO) "Generating: $@"
$(if $(VERBOSE:1=),@)$(LD) $(UCMD_OBJ) $(LIB_OBJ) $(LDFLAGS) -o $@
@$(ECHO)
 
$(GPSIGN_EXE): $(GPSIGN_OBJ) $(LIB_OBJ) makefile
@$(ECHO) "Generating: $@"
$(if $(VERBOSE:1=),@)$(LD) $(GPSIGN_OBJ) $(LIB_OBJ) $(LDFLAGS) -o $@
@$(ECHO)
 
$(PUSB_EXE): $(PUSB_OBJ) $(LIB_OBJ) makefile
@$(ECHO) "Generating: $@"
$(if $(VERBOSE:1=),@)$(LD) $(PUSB_OBJ) $(LIB_OBJ) $(LDFLAGS) $(LDFLAGS_USB) -o $@
@$(ECHO)
 
.PHONY : docs
docs:
@$(ECHO) "Generating Documentation:"
$(if $(VERBOSE:1=),@)-$(DOXYGEN) docs/doxyfile
$(if $(VERBOSE:1=),@)-$(MAKE) -C docs/latex
.PHONY : clean
clean:
@$(ECHO) "Cleaning:"
$(if $(VERBOSE:1=),@)-$(RM) -$(if $(VERBOSE:1=),,v)f $(CLEANUPFILES) core
 
.PHONY : distclean
distclean:
@$(ECHO) "Dist cleaning:"
$(if $(VERBOSE:1=),@)-$(RM) -$(if $(VERBOSE:1=),,v)f $(CLEANUPFILES)
$(if $(VERBOSE:1=),@)-$(RM) -r$(if $(VERBOSE:1=),,v)f $(DOCS)
ifndef WINDOWS
$(if $(VERBOSE:1=),@)find $(srctree) $(RCS_FIND_IGNORE) \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' -o -size 0 \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -$(if $(VERBOSE:1=),,v)f
endif