grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / classes / zune / nlist / nlistview_mcc / Makefile
blobf66efc72188bcd6b842cb6cecfd38a06ee961495
1 #/***************************************************************************
3 # NListview.mcc - New Listview MUI Custom Class
4 # Registered MUI class, Serial Number: 1d51 (0x9d510020 to 0x9d51002F)
6 # Copyright (C) 1996-2001 by Gilles Masson
7 # Copyright (C) 2001-2014 NList Open Source Team
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # NList classes Support Site: http://www.sf.net/projects/nlist-classes
21 # $Id$
23 #***************************************************************************/
25 ###########################################################################
26 # This makefile is a very generic one. It tries to identify both, the host
27 # and the target operating system for which YAM should be compiled.
28 # However, this auto-detection can be easily overridden by directly
29 # specifying an option on the commandline while calling 'make'.
31 # Example:
33 # # to explicitly compile for AmigaOS3
34 # > make OS=os3
36 # # to compile for AmigaOS4 but with debugging
37 # > make OS=os4 DEBUG=
40 #############################################
41 # find out the HOST operating system
42 # on which this makefile is run
43 HOST ?= $(shell uname)
44 ifeq ($(HOST), AmigaOS)
45 ifeq ($(shell uname -m), powerpc)
46 HOST = AmigaOS4
47 endif
48 ifeq ($(shell uname -m), ppc)
49 HOST = AmigaOS4
50 endif
51 endif
53 # if no host is identifed (no uname tool)
54 # we assume a AmigaOS build
55 ifeq ($(HOST),)
56 HOST = AmigaOS
57 endif
59 #############################################
60 # now we find out the target OS for
61 # which we are going to compile YAM in case
62 # the caller didn't yet define OS himself
63 ifndef (OS)
64 ifeq ($(HOST), AmigaOS4)
65 OS = os4
66 else
67 ifeq ($(HOST), AmigaOS)
68 OS = os3
69 else
70 ifeq ($(HOST), MorphOS)
71 OS = mos
72 else
73 ifeq ($(HOST), AROS)
74 # now we find out which CPU system aros will be used
75 ifeq ($(shell uname -m), powerpc)
76 OS = aros-ppc
77 endif
78 ifeq ($(shell uname -m), ppc)
79 OS = aros-ppc
80 endif
81 ifeq ($(shell uname -m), i386)
82 OS = aros-i386
83 endif
84 ifeq ($(shell uname -m), i686)
85 OS = aros-i686
86 endif
87 ifeq ($(shell uname -m), x86_64)
88 OS = aros-x86_64
89 endif
90 else
91 OS = os4
92 endif
93 endif
94 endif
95 endif
96 endif
98 #############################################
99 # define common commands we use in this
100 # makefile. Please note that each of them
101 # might be overridden on the commandline.
103 # common commands
104 FLEX = flex
105 FC = flexcat
106 EXPR = expr
107 DATE = date
108 RM = rm -f #delete force
109 RMDIR = rm -rf #delete force all
110 MKDIR = mkdir -p #makedir force
111 CHMOD = protect FLAGS=rwed
112 SED = sed
113 CP = copy
114 CC = gcc
115 STRIP = strip
116 OBJDUMP = objdump
118 # path definitions
119 CDUP = /
120 CDTHIS=
122 # override some variables for non-native builds (cross-compiler)
123 ifneq ($(HOST), AmigaOS)
124 ifneq ($(HOST), AmigaOS4)
125 ifneq ($(HOST), MorphOS)
127 # when we end up here this is either a unix or Aros host
128 # so lets use unix kind of commands
129 RM = rm -f
130 RMDIR = rm -rf
131 MKDIR = mkdir -p
132 CHMOD = chmod 755
133 CP = cp -f
135 CDUP = ../
136 CDTHIS= ./
138 endif
139 endif
140 endif
142 ###########################################################################
143 # CPU and DEBUG can be defined outside, defaults to above
144 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
145 # PPC-603e version
147 # OPTFLAGS are disabled by DEBUG normally!
149 # ignored warnings are:
150 # none - because we want to compile with -Wall all the time
152 # Common Directories
153 PREFIX = $(CDTHIS)
154 OBJDIR = .obj_$(OS)
155 BINDIR = bin_$(OS)
156 VPATH = $(OBJDIR)
157 DEPFILE = Makefile.dep
158 DESTDIR = MUI:Libs/MUI
160 # target definition
161 TARGET = $(BINDIR)/NListview.mcc
162 TESTTARGET= $(BINDIR)/NListview-Test
164 # Common compiler/linker flags
165 WARN = -W -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare
166 OPTFLAGS = -O3 -fomit-frame-pointer
167 DEBUG = -DDEBUG -fno-omit-frame-pointer -O0
168 DEBUGSYM = -g -gstabs
169 CFLAGS = -I. -I../nlistviews_mcp -I../include $(CPU) $(WARN) \
170 $(OPTFLAGS) $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS) -c
171 LDFLAGS = $(CPU) $(DEBUGSYM)
172 LDLIBS =
174 ###########################################################################
175 # object files definition
178 LOBJS = library.o
180 COBJS = NListview.o \
181 Debug.o
183 TOBJS = #NListview-Test.o
185 MCCOBJS = $(addprefix $(OBJDIR)/,$(LOBJS)) $(addprefix $(OBJDIR)/,$(COBJS))
186 TESTOBJS = $(addprefix $(OBJDIR)/,$(COBJS)) $(addprefix $(OBJDIR)/,$(TOBJS))
188 # different options per target OS
189 ifeq ($(OS), os4)
191 ##############################
192 # AmigaOS4
194 # Compiler/link/strip commands
195 ifneq ($(HOST), AmigaOS4)
196 CC = ppc-amigaos-gcc
197 STRIP = ppc-amigaos-strip
198 OBJDUMP = ppc-amigaos-objdump
199 endif
201 # Compiler/Linker flags
202 CRT = newlib
203 CPU = -mcpu=powerpc
204 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
205 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
206 -DNO_PPCINLINE_STDARG -Wa,-mregnames
207 LDFLAGS += -mcrt=$(CRT)
209 # additional object files required
210 M68KSTUBS = $(OBJDIR)/mccclass_68k.o
212 else
213 ifeq ($(OS), os3)
215 ##############################
216 # AmigaOS3
218 # Compiler/link/strip commands
219 ifneq ($(HOST), AmigaOS)
220 CC = m68k-amigaos-gcc
221 STRIP = m68k-amigaos-strip
222 OBJDUMP = m68k-amigaos-objdump
223 endif
225 # Compiler/Linker flags
226 CPU = -m68020-60 -msoft-float
227 CFLAGS += -noixemul -DNO_INLINE_STDARG -D__amigaos3__
228 LDFLAGS += -noixemul
229 LDLIBS += -ldebug -lmui
231 # additional object files required
232 COBJS += vastubs.o
234 else
235 ifeq ($(OS), mos)
237 ##############################
238 # MorphOS
240 # Compiler/link/strip commands
241 ifneq ($(HOST), MorphOS)
242 CC = ppc-morphos-gcc
243 STRIP = ppc-morphos-strip
244 OBJDUMP = ppc-morphos-objdump
245 endif
247 # Compiler/Linker flags
248 CPU = -mcpu=powerpc
249 CFLAGS += -noixemul -DNO_PPCINLINE_STDARG
250 LDFLAGS += -noixemul
251 LDLIBS += -ldebug
253 else
254 ifeq ($(OS), aros-i386)
256 ##############################
257 # AROS (i386)
259 ifneq ($(HOST), AROS)
260 CC = i386-aros-gcc
261 STRIP = i386-aros-strip
262 OBJDUMP = i386-aros-objdump
263 endif
265 # Compiler/Linker flags
266 OPTFLAGS = -O2 -fomit-frame-pointer
267 CFLAGS += -Wno-pointer-sign
268 LDLIBS += -larossupport -lrom -lmui
270 else
271 ifeq ($(OS), aros-ppc)
273 ##############################
274 # AROS (PPC)
276 ifneq ($(HOST), AROS)
277 CC = ppc-aros-gcc
278 STRIP = ppc-aros-strip
279 OBJDUMP = ppc-aros-objdump
280 endif
282 # Compiler/Linker flags
283 OPTFLAGS = -O2 -fomit-frame-pointer
284 CFLAGS += -Wno-pointer-sign
285 LDLIBS += -larossupport -lrom -lmui
287 else
288 ifeq ($(OS), aros-x86_64)
290 ##############################
291 # AROS (x86_64)
293 ifneq ($(HOST), AROS)
294 CC = x86_64-aros-gcc
295 STRIP = x86_64-aros-strip
296 OBJDUMP = x86_64-aros-objdump
297 endif
299 # Compiler/Linker flags
300 OPTFLAGS = -O2 -fomit-frame-pointer
301 CFLAGS += -Wno-pointer-sign
302 LDLIBS += -larossupport -lrom -lmui
304 endif
305 endif
306 endif
307 endif
308 endif
309 endif
311 # main target
312 .PHONY: all
313 ifeq ($(wildcard $(DEPFILE)),$(DEPFILE))
314 # great, we have a dependecies file, let's make our target
315 all: $(BINDIR) $(OBJDIR) $(M68KSTUBS) $(TARGET) #$(TESTTARGET)
316 else
317 # no dependecies, create it and then call make again
318 all: depend
319 @make --no-print-directory all
320 endif
322 # for making a release we compile ALL target with no debug
323 release:
324 @echo " CC $<"
325 make OS=os4 clean
326 make OS=os4 DEBUG=
327 @echo " CC $<"
328 make OS=os3 clean
329 make OS=os3 DEBUG=
330 @echo " CC $<"
331 make OS=mos clean
332 make OS=mos DEBUG=
333 @echo " CC $<"
334 make OS=aros-i386 clean
335 make OS=aros-i386 DEBUG=
336 @echo " CC $<"
337 make OS=aros-ppc clean
338 make OS=aros-ppc DEBUG=
339 @echo " CC $<"
340 make OS=aros-x86_64 clean
341 make OS=aros-x86_64 DEBUG=
343 # make the object directories
344 $(OBJDIR):
345 @echo " MK $@"
346 @$(MKDIR) $(OBJDIR)
348 # make the binary directories
349 $(BINDIR):
350 @echo " MK $@"
351 @$(MKDIR) $(BINDIR)
353 # for compiling single .c files
354 $(OBJDIR)/%.o: %.c
355 @echo " CC $<"
356 @$(CC) $(CFLAGS) $< -o $@
358 $(OBJDIR)/mccclass_68k.o: ../include/mccclass_68k.c
359 @echo " CC $<"
360 @$(CC) $(CFLAGS) $< -o $@
362 # for linking the target
363 $(TARGET): $(M68KSTUBS) $(MCCOBJS)
364 @echo " LD $@.debug"
365 @$(CC) -nostartfiles $(LDFLAGS) -o $@.debug $(MCCOBJS) $(M68KSTUBS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
366 @echo " LD $@"
367 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
369 # for linking the target
370 $(TESTTARGET): $(TESTOBJS)
371 @echo " LD $@.debug"
372 @$(CC) $(LDFLAGS) -o $@.debug $(TESTOBJS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
373 @echo " LD $@"
374 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
376 .PHONY: dump
377 dump:
378 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET) >$(TARGET).dump
380 .PHONY: clean
381 clean:
382 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map
383 -$(RM) $(TESTTARGET) $(TESTTARGET).debug $(TESTTARGET).map
384 -$(RM) $(MCCOBJS) $(TESTOBJS) $(M68KSTUBS)
386 .PHONY: distclean
387 distclean: clean
388 -$(RMDIR) $(OBJDIR)
389 -$(RMDIR) $(BINDIR)
391 # install
392 .PHONY: install
393 install: all
394 @echo " IN $(TARGET)"
395 @$(CP) $(TARGET) $(DESTDIR)
397 .PHONY: help
398 help:
399 @echo "Cleaning targets:"
400 @echo " clean - Cleanup working directory for clean compile"
401 @echo " distclean - Also cleanup autogenerated files"
402 @echo ""
403 @echo "Other generic targets:"
404 @echo " all - Build $(TARGET)"
405 @echo " catalogs - Build all available catalogs"
406 @echo ""
407 @echo "Install targets:"
408 @echo " install - Install $(TARGET) into $(DESTDIR)"
409 @echo ""
410 @echo "Parameters:"
411 @echo " make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
412 @echo " make DEBUG= : build $(TARGET) without debugging information"
413 @echo ""
415 ## DEPENDENCY GENERATION ##############
417 .PHONY: depend
418 depend:
419 @echo " MK $(DEPFILE)"
420 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE)
421 @$(CC) -MM -MG $(CFLAGS) $(wildcard *.c) >>$(DEPFILE)
422 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE)
423 @$(SED) -i 's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE)
425 # include dependencies file
426 -include $(DEPFILE)