grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / classes / zune / nlist / nlistviews_mcp / Makefile
blob48efa04438d0080501ecdf0e3c43ecdd05eae82f
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 = delete force
109 RMDIR = delete force all
110 MKDIR = makedir
111 CHMOD = protect FLAGS=rwed
112 SED = sed
113 CP = copy
114 CC = gcc
115 STRIP = strip
116 OBJDUMP = objdump
118 # override commands for native builds
119 ifeq ($(HOST), AmigaOS4)
120 # AmigaOS4 host
121 # RM = delete force
122 # RMDIR = delete force all
123 # MKDIR = makedir
124 DATE = gdate
125 else
126 ifeq ($(HOST), AmigaOS)
127 # AmigaOS3 host
128 RM = delete force
129 RMDIR = delete force all
130 MKDIR = makedir
131 else
132 ifeq ($(HOST), MorphOS)
133 # MorphOS host
134 RM = delete force
135 RMDIR = delete force all
136 MKDIR = makedir
137 endif
138 endif
139 endif
141 # path definitions
142 CDUP = /
143 CDTHIS=
145 # override some variables for non-native builds (cross-compiler)
146 ifneq ($(HOST), AmigaOS)
147 ifneq ($(HOST), AmigaOS4)
148 ifneq ($(HOST), MorphOS)
150 # when we end up here this is either a unix or Aros host
151 # so lets use unix kind of commands
152 RM = rm -f
153 RMDIR = rm -rf
154 MKDIR = mkdir -p
155 CHMOD = chmod 755
156 CP = cp -f
158 CDUP = ../
159 CDTHIS= ./
161 endif
162 endif
163 endif
165 ###########################################################################
166 # CPU and DEBUG can be defined outside, defaults to above
167 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
168 # PPC-603e version
170 # OPTFLAGS are disabled by DEBUG normally!
172 # ignored warnings are:
173 # none - because we want to compile with -Wall all the time
175 # Common Directories
176 PREFIX = $(CDTHIS)
177 OBJDIR = .obj_$(OS)
178 BINDIR = bin_$(OS)
179 LOCALE = locale
180 VPATH = $(OBJDIR)
181 DEPFILE = Makefile.dep
182 DESTDIR = MUI:Libs/MUI
184 # target definition
185 TARGET = $(BINDIR)/NListviews.mcp
186 TESTTARGET= $(BINDIR)/NListviews-Prefs
188 # Common compiler/linker flags
189 WARN = -W -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare
190 OPTFLAGS = -O3 -fomit-frame-pointer
191 DEBUG = -DDEBUG -fno-omit-frame-pointer -O0
192 DEBUGSYM = -g -gstabs
193 CFLAGS = -I. -I../nlistviews_mcp -I../include $(CPU) $(WARN) \
194 $(OPTFLAGS) $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS) -c
195 LDFLAGS = $(CPU) $(DEBUGSYM)
196 LDLIBS =
198 ###########################################################################
199 # object files definition
202 LOBJS = library.o
204 COBJS = locale.o \
205 NListviews.o \
206 icon.o \
207 Debug.o
209 TOBJS = NListviews-Prefs.o
211 MCCOBJS = $(addprefix $(OBJDIR)/,$(LOBJS)) $(addprefix $(OBJDIR)/,$(COBJS))
212 TESTOBJS = $(addprefix $(OBJDIR)/,$(COBJS)) $(addprefix $(OBJDIR)/,$(TOBJS))
214 # available catalog translations
215 CATALOGS = $(patsubst %.po,%.catalog,$(wildcard $(LOCALE)/*.po))
217 # different options per target OS
218 ifeq ($(OS), os4)
220 ##############################
221 # AmigaOS4
223 # Compiler/link/strip commands
224 ifneq ($(HOST), AmigaOS4)
225 CC = ppc-amigaos-gcc
226 STRIP = ppc-amigaos-strip
227 OBJDUMP = ppc-amigaos-objdump
228 endif
230 # Compiler/Linker flags
231 CRT = newlib
232 CPU = -mcpu=powerpc
233 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
234 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
235 -DNO_PPCINLINE_STDARG -Wa,-mregnames
236 LDFLAGS += -mcrt=$(CRT)
238 # additional object files required
239 M68KSTUBS = $(OBJDIR)/mccclass_68k.o
241 else
242 ifeq ($(OS), os3)
244 ##############################
245 # AmigaOS3
247 # Compiler/link/strip commands
248 ifneq ($(HOST), AmigaOS)
249 CC = m68k-amigaos-gcc
250 STRIP = m68k-amigaos-strip
251 OBJDUMP = m68k-amigaos-objdump
252 endif
254 # Compiler/Linker flags
255 CPU = -m68020-60 -msoft-float
256 CFLAGS += -noixemul -DNO_INLINE_STDARG -D__amigaos3__
257 LDFLAGS += -noixemul
258 LDLIBS += -ldebug -lmui
260 # additional object files required
261 COBJS += vastubs.o
263 else
264 ifeq ($(OS), mos)
266 ##############################
267 # MorphOS
269 # Compiler/link/strip commands
270 ifneq ($(HOST), MorphOS)
271 CC = ppc-morphos-gcc
272 STRIP = ppc-morphos-strip
273 OBJDUMP = ppc-morphos-objdump
274 endif
276 # Compiler/Linker flags
277 CPU = -mcpu=powerpc
278 CFLAGS += -noixemul -DNO_PPCINLINE_STDARG
279 LDFLAGS += -noixemul
280 LDLIBS += -ldebug
282 else
283 ifeq ($(OS), aros-i386)
285 ##############################
286 # AROS (i386)
288 ifneq ($(HOST), AROS)
289 CC = i386-aros-gcc
290 STRIP = i386-aros-strip
291 OBJDUMP = i386-aros-objdump
292 endif
294 # Compiler/Linker flags
295 OPTFLAGS = -O2 -fomit-frame-pointer
296 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
297 LDLIBS += -larossupport -lrom -lmui
299 else
300 ifeq ($(OS), aros-ppc)
302 ##############################
303 # AROS (PPC)
305 ifneq ($(HOST), AROS)
306 CC = ppc-aros-gcc
307 STRIP = ppc-aros-strip
308 OBJDUMP = ppc-aros-objdump
309 endif
311 # Compiler/Linker flags
312 OPTFLAGS = -O2 -fomit-frame-pointer
313 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
314 LDLIBS += -larossupport -lrom -lmui
316 else
317 ifeq ($(OS), aros-x86_64)
319 ##############################
320 # AROS (x86_64)
322 ifneq ($(HOST), AROS)
323 CC = x86_64-aros-gcc
324 STRIP = x86_64-aros-strip
325 OBJDUMP = x86_64-aros-objdump
326 endif
328 # Compiler/Linker flags
329 OPTFLAGS = -O2 -fomit-frame-pointer
330 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
331 LDLIBS += -larossupport -lrom -lmui
333 endif
334 endif
335 endif
336 endif
337 endif
338 endif
340 # main target
341 .PHONY: all
342 ifeq ($(wildcard $(DEPFILE)),$(DEPFILE))
343 # great, we have a dependecies file, let's make our target
344 all: $(BINDIR) $(OBJDIR) $(M68KSTUBS) locale.c $(TARGET) $(TESTTARGET)
345 else
346 # no dependecies, create it and then call make again
347 all: depend
348 @make --no-print-directory all
349 endif
351 # for making a release we compile ALL target with no debug
352 release:
353 @echo " CC $<"
354 make OS=os4 clean
355 make OS=os4 DEBUG=
356 @echo " CC $<"
357 make OS=os3 clean
358 make OS=os3 DEBUG=
359 @echo " CC $<"
360 make OS=mos clean
361 make OS=mos DEBUG=
362 @echo " CC $<"
363 make OS=aros-i386 clean
364 make OS=aros-i386 DEBUG=
365 @echo " CC $<"
366 make OS=aros-ppc clean
367 make OS=aros-ppc DEBUG=
368 @echo " CC $<"
369 make OS=aros-x86_64 clean
370 make OS=aros-x86_64 DEBUG=
372 # make the object directories
373 $(OBJDIR):
374 @echo " MK $@"
375 @$(MKDIR) $(OBJDIR)
377 # make the binary directories
378 $(BINDIR):
379 @echo " MK $@"
380 @$(MKDIR) $(BINDIR)
382 # for compiling single .c files
383 $(OBJDIR)/%.o: %.c
384 @echo " CC $<"
385 @$(CC) $(CFLAGS) $< -o $@
387 $(OBJDIR)/mccclass_68k.o: ../include/mccclass_68k.c
388 @echo " CC $<"
389 @$(CC) $(CFLAGS) $< -o $@
391 # for linking the target
392 $(TARGET): $(M68KSTUBS) $(MCCOBJS)
393 @echo " LD $@.debug"
394 @$(CC) -nostartfiles $(LDFLAGS) -o $@.debug $(MCCOBJS) $(M68KSTUBS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
395 @echo " LD $@"
396 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
398 # for linking the target
399 $(TESTTARGET): $(TESTOBJS)
400 @echo " LD $@.debug"
401 @$(CC) $(LDFLAGS) -o $@.debug $(TESTOBJS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
402 @echo " LD $@"
403 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
405 locale.h: locale.c
406 locale.c: $(LOCALE)/NListviews_mcp.pot C_h.sd C_c.sd
407 @echo " FC $@"
408 @$(FC) $(LOCALE)/NListviews_mcp.pot locale.h=C_h.sd locale.c=C_c.sd
410 ## CATALOG GENERATION #################
412 $(LOCALE)/%.catalog: $(LOCALE)/%.po $(LOCALE)/NListviews_mcp.pot
413 @echo " FC $@"
414 @$(FC) POFILE $< CATALOG $@
416 .IGNORE: $(CATALOGS)
418 catalogs: $(CATALOGS)
420 .PHONY: dump
421 dump:
422 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET) >$(TARGET).dump
424 .PHONY: clean
425 clean:
426 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map
427 -$(RM) $(TESTTARGET) $(TESTTARGET).debug $(TESTTARGET).map
428 -$(RM) $(MCCOBJS) $(TESTOBJS) $(M68KSTUBS)
429 -$(RM) $(CATALOGS)
431 .PHONY: distclean
432 distclean: clean
433 -$(RM) locale.?
434 -$(RM) $(LOCALE)/*.catalog
435 -$(RMDIR) $(OBJDIR)
436 -$(RMDIR) $(BINDIR)
438 # install
439 .PHONY: install
440 install: all
441 @echo " IN $(TARGET)"
442 @$(CP) $(TARGET) $(DESTDIR)
444 .PHONY: help
445 help:
446 @echo "Cleaning targets:"
447 @echo " clean - Cleanup working directory for clean compile"
448 @echo " distclean - Also cleanup autogenerated files"
449 @echo ""
450 @echo "Other generic targets:"
451 @echo " all - Build $(TARGET)"
452 @echo " catalogs - Build all available catalogs"
453 @echo ""
454 @echo "Install targets:"
455 @echo " install - Install $(TARGET) into $(DESTDIR)"
456 @echo ""
457 @echo "Parameters:"
458 @echo " make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
459 @echo " make DEBUG= : build $(TARGET) without debugging information"
460 @echo ""
462 ## DEPENDENCY GENERATION ##############
464 .PHONY: depend
465 depend:
466 @echo " MK $(DEPFILE)"
467 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE)
468 @$(CC) -MM -MG $(CFLAGS) $(wildcard *.c) >>$(DEPFILE)
469 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE)
470 @$(SED) -i 's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE)
472 # include dependencies file
473 -include $(DEPFILE)