Updated to rev. 134 from its own Sourceforge project
[AROS-Contrib.git] / mui / classes / thebar / mcc / Makefile
blobfa97524a1c891774fe772dcd28a86be32831156c
1 #/***************************************************************************
3 # TheBar.mcc - Next Generation Toolbar MUI Custom Class
4 # Copyright (C) 2003-2005 Alfonso Ranieri
5 # Copyright (C) 2005-2007 by TheBar.mcc Open Source Team
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # TheBar class Support Site: http://www.sf.net/projects/thebar
19 # $Id: Makefile.os4 22 2007-01-02 21:30:56Z damato $
21 #***************************************************************************/
23 ###########################################################################
24 # This makefile is a very generic one. It tries to identify both, the host
25 # and the target operating system for which TheBar should be compiled.
26 # However, this auto-detection can be easily overridden by directly
27 # specifying an option on the commandline while calling 'make'.
29 # Example:
31 # # to explicitly compile for AmigaOS3
32 # > make OS=os3
34 # # to compile for AmigaOS4 but with debugging
35 # > make OS=os4 DEBUG=
38 #############################################
39 # find out the HOST operating system
40 # on which this makefile is run
41 ifndef (HOST)
42 HOST = $(shell uname)
43 ifeq ($(HOST), AmigaOS)
44 ifeq ($(shell uname -m), powerpc)
45 HOST = AmigaOS4
46 endif
47 ifeq ($(shell uname -m), ppc)
48 HOST = AmigaOS4
49 endif
50 endif
51 endif
53 #############################################
54 # now we find out the target OS for
55 # which we are going to compile TheBar in case
56 # the caller didn't yet define OS himself
57 ifndef (OS)
58 ifeq ($(HOST), AmigaOS4)
59 OS = os4
60 else
61 ifeq ($(HOST), AmigaOS)
62 OS = os3
63 else
64 ifeq ($(HOST), MorphOS)
65 OS = mos
66 else
67 ifeq ($(HOST), Aros)
68 OS = aros
69 else
70 OS = os4
71 endif
72 endif
73 endif
74 endif
75 endif
77 #############################################
78 # define common commands we use in this
79 # makefile. Please note that each of them
80 # might be overridden on the commandline.
82 # common commands
83 FLEX = flex
84 FC = flexcat
85 EXPR = expr
86 CHMOD = chmod
87 SED = sed
88 DATE = date
89 RM = rm -f
90 RMDIR = rm -rf
91 MKDIR = mkdir
93 # override commands for native builds
94 ifeq ($(HOST), AmigaOS4)
95 # AmigaOS4 host
96 RM = delete force
97 RMDIR = delete force all
98 MKDIR = makedir
99 DATE = gdate
100 else
101 ifeq ($(HOST), AmigaOS)
102 # AmigaOS3 host
103 RM = delete force
104 RMDIR = delete force all
105 MKDIR = makedir
106 else
107 ifeq ($(HOST), MorphOS)
108 # MorphOS host
109 RM = delete force
110 RMDIR = delete force all
111 MKDIR = makedir
112 endif
113 endif
114 endif
116 ###########################################################################
117 # CPU and DEBUG can be defined outside, defaults to above
118 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
119 # PPC-603e version
121 # OPTFLAGS are disabled by DEBUG normally!
123 # ignored warnings are:
124 # none - because we want to compile with -Wall all the time
126 # Common Directories
127 OBJDIR = .obj_$(OS)
128 BINDIR = bin_$(OS)
130 # target definition
131 MCCTARGET = $(BINDIR)/TheBar.mcc
132 MCCVTARGET= $(BINDIR)/TheBarVirt.mcc
133 TESTTARGET= $(BINDIR)/TheBar-Test
135 # Common compiler/linker flags
136 WARN = -W -Wall -Wwrite-strings
137 OPTFLAGS = -O3 -fomit-frame-pointer -funroll-loops
138 DEBUG = -DDEBUG -O0
139 DEBUGSYM = -gstabs
140 CFLAGS = -I. -I../mcp -I../include $(CPU) $(WARN) $(OPTFLAGS) \
141 $(DEBUG) $(DEBUGSYM) -c
142 LDFLAGS = $(CPU) $(DEBUGSYM) -nostartfiles
143 LDLIBS = -lm
145 # different options per target OS
146 ifeq ($(OS), os4)
148 ##############################
149 # AmigaOS4
151 # Compiler/link/strip commands
152 CC = ppc-amigaos-gcc
153 STRIP = ppc-amigaos-strip
154 OBJDUMP = ppc-amigaos-objdump
156 # Compiler/Linker flags
157 CRT = newlib
158 CPU = -mcpu=powerpc
159 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
160 -DNO_PPCINLINE_STDARG -Wa,-mregnames
161 LDFLAGS += -mcrt=$(CRT)
163 # additional object files required
164 M68KSTUBS = $(OBJDIR)/mccclass_68k.o
166 else
167 ifeq ($(OS), os3)
169 ##############################
170 # AmigaOS3
172 # Compiler/link/strip commands
173 CC = m68k-amigaos-gcc
174 STRIP = m68k-amigaos-strip
175 OBJDUMP = m68k-amigaos-objdump
177 # Compiler/Linker flags
178 CPU = -m68020-60 -msoft-float
179 CFLAGS += -noixemul -DNO_INLINE_STDARG
180 LDFLAGS += -noixemul
181 LDLIBS += -ldebug -lmui
183 else
184 ifeq ($(OS), mos)
186 ##############################
187 # MorphOS
189 # Compiler/link/strip commands
190 CC = ppc-morphos-gcc
191 STRIP = ppc-morphos-strip
192 OBJDUMP = ppc-morphos-objdump
194 # Compiler/Linker flags
195 CPU = -mcpu=powerpc
196 CFLAGS += -noixemul -DNO_PPCINLINE_STDARG
197 LDFLAGS += -noixemul
198 LDLIBS += -ldebug
200 else
201 ifeq ($(OS), aros)
203 ##############################
204 # AROS
206 # Compiler/link/strip commands
207 CC = i686-aros-gcc
208 STRIP = i686-aros-strip
209 OBJDUMP = i686-aros-objdump
211 # Compiler/Linker flags
212 CPU =
214 endif
215 endif
216 endif
217 endif
219 ###########################################################################
220 # Here starts all stuff that is common for all target platforms and
221 # hosts.
223 MCCOBJS = $(OBJDIR)/mcc/library.o \
224 $(OBJDIR)/mcc/brc1.o \
225 $(OBJDIR)/mcc/build.o \
226 $(OBJDIR)/mcc/class.o \
227 $(OBJDIR)/mcc/dragbar.o \
228 $(OBJDIR)/mcc/scale.o \
229 $(OBJDIR)/mcc/spacer.o \
230 $(OBJDIR)/mcc/utils.o \
231 $(OBJDIR)/Debug.o
233 MCCVOBJS= $(OBJDIR)/mccv/library.o \
234 $(OBJDIR)/mccv/brc1.o \
235 $(OBJDIR)/mccv/build.o \
236 $(OBJDIR)/mccv/class.o \
237 $(OBJDIR)/mccv/dragbar.o \
238 $(OBJDIR)/mccv/scale.o \
239 $(OBJDIR)/mccv/spacer.o \
240 $(OBJDIR)/mccv/utils.o \
241 $(OBJDIR)/Debug.o
243 TESTOBJS= $(OBJDIR)/TheBar-Test.o \
244 $(OBJDIR)/mcc/brc1.o \
245 $(OBJDIR)/mcc/build.o \
246 $(OBJDIR)/mcc/class.o \
247 $(OBJDIR)/mcc/dragbar.o \
248 $(OBJDIR)/mcc/scale.o \
249 $(OBJDIR)/mcc/spacer.o \
250 $(OBJDIR)/mcc/utils.o \
251 $(OBJDIR)/Debug.o
255 all: $(BINDIR) $(OBJDIR) $(MCCTARGET) $(MCCVTARGET) $(TESTTARGET)
257 # make the object directories
258 $(OBJDIR):
259 @printf '\033[33mGenerating $@ directory\033[0m\n'
260 @$(MKDIR) $(OBJDIR)
261 @$(MKDIR) $(OBJDIR)/mcc
262 @$(MKDIR) $(OBJDIR)/mccv
265 # make the binary directories
266 $(BINDIR):
267 @printf '\033[33mGenerating $@ directory\033[0m\n'
268 @$(MKDIR) $(BINDIR)
272 $(OBJDIR)/%.o: %.c
273 @printf '\033[32mCompiling $<\033[0m\n'
274 @$(CC) $(CFLAGS) $< -o $@
276 $(OBJDIR)/mcc/%.o: %.c
277 @printf '\033[32mCompiling $<\033[0m\n'
278 @$(CC) $(CFLAGS) $< -o $@
280 $(OBJDIR)/mccv/%.o: %.c
281 @printf '\033[32mCompiling $<\033[0m\n'
282 @$(CC) $(CFLAGS) -DVIRTUAL $< -o $@
284 $(OBJDIR)/mccclass_68k.o: ../include/mccclass_68k.c
285 @printf '\033[32mCompiling $<\033[0m\n'
286 @$(CC) $(CFLAGS) $< -o $@
290 $(MCCTARGET): $(M68KSTUBS) $(MCCOBJS)
291 @printf '\033[32mLinking \033[1m$@\033[0m\n'
292 @$(CC) $(LDFLAGS) -o $@.debug $(MCCOBJS) $(M68KSTUBS) $(LDLIBS) -Wl,-Map,$@.map
293 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
295 $(MCCVTARGET): $(M68KSTUBS) $(MCCVOBJS)
296 @printf '\033[32mLinking \033[1m$@\033[0m\n'
297 @$(CC) $(LDFLAGS) -o $@.debug $(MCCVOBJS) $(M68KSTUBS) $(LDLIBS) -Wl,-Map,$@.map
298 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
300 $(TESTTARGET): $(TESTOBJS)
301 @printf '\033[32mLinking \033[1m$@\033[0m\n'
302 @$(CC) -noixemul -o $@.debug $(TESTOBJS) $(LDLIBS) -Wl,-Map,$@.map
303 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
305 ## DEPENDENCY GENERATION ##############
307 Makefile.depend: ;
308 @printf "\033[33mWARNING: Makefile.depend missing. Please run 'make depend'\033[0m\n"
310 .PHONY: depend
311 depend:
312 @printf '\033[33mGenerating Makefile.depend\033[0m\n'
313 @echo '# AUTOGENERATED! DO NOT EDIT!!!' >Makefile.depend
314 @$(CC) $(CFLAGS) $(MCCOBJS:$(OBJDIR)/mcc/%.o=./%.c) -MM >>Makefile.depend
315 @$(SED) -i 's,^\([^$$].*\)\.o: ,$$\(OBJDIR\)/mcc/\1.o: ,g' Makefile.depend
316 @$(CC) $(CFLAGS) $(MCCVOBJS:$(OBJDIR)/mccv/%.o=./%.c) -MM >>Makefile.depend
317 @$(SED) -i 's,^\([^$$].*\)\.o: ,$$\(OBJDIR\)/mccv/\1.o: ,g' Makefile.depend
318 @echo '# AUTOGENERATED! DO NOT EDIT!!!' >>Makefile.depend
322 .PHONY: clean
323 clean:
324 -$(RM) $(MCCTARGET) $(MCCTARGET).debug $(MCCTARGET).map
325 -$(RM) $(MCCVTARGET) $(MCCVTARGET).debug $(MCCVTARGET).map
326 -$(RM) $(TESTTARGET) $(TESTTARGET).debug $(TESTTARGET).map
327 -$(RM) $(MCCOBJS) $(MCCVOBJS) $(TESTOBJS) $(M68KSTUBS)
329 .PHONY: distclean
330 distclean: clean
331 -$(RMDIR) $(OBJDIR)/mccv
332 -$(RMDIR) $(OBJDIR)/mcc
333 -$(RMDIR) $(OBJDIR)
334 -$(RMDIR) $(BINDIR)
336 ## DEPENDENCY INCLUDE #################
338 -include Makefile.depend