1## -*- makefile -*- -------------------------------------------------------
2##   
3##   Copyright 2008 H. Peter Anvin - All Rights Reserved
4##
5##   This program is free software; you can redistribute it and/or modify
6##   it under the terms of the GNU General Public License as published by
7##   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8##   Boston MA 02110-1301, USA; either version 2 of the License, or
9##   (at your option) any later version; incorporated herein by reference.
10##
11## -----------------------------------------------------------------------
12
13##
14## Common configurables
15##
16
17# No builtin rules
18MAKEFLAGS += -r
19MAKE      += -r
20
21BINDIR   = /usr/bin
22SBINDIR  = /sbin
23LIBDIR   = /usr/lib
24DATADIR  = /usr/share
25AUXDIR   = $(DATADIR)/syslinux
26DIAGDIR  = $(AUXDIR)/diag
27MANDIR	 = /usr/man
28INCDIR   = /usr/include
29TFTPBOOT = /tftpboot
30COM32DIR = $(AUXDIR)/com32
31
32BOOTDIR	    = /boot
33EXTLINUXDIR = $(BOOTDIR)/extlinux
34
35ifdef DEBUG
36# This allows DEBUGOPT to be set from the command line
37DEBUGOPT = -DDEBUG=$(DEBUG)
38endif
39
40NASM	 = nasm
41NASMOPT  = -Ox $(DEBUGOPT)
42
43PERL	 = perl
44PYTHON	 = python
45UPX	 = upx
46
47CHMOD	 = chmod
48
49CC	 = gcc
50gcc_ok   = $(shell tmpf=gcc_ok.$$$$.tmp; \
51		   if $(CC) $(GCCOPT) $(1) -c $(topdir)/dummy.c \
52			-o $$tmpf 2>/dev/null ; \
53		   then echo '$(1)'; else echo '$(2)'; fi; \
54		   rm -f $$tmpf)
55
56LD	 = ld
57OBJDUMP	 = objdump
58OBJCOPY  = objcopy
59STRIP    = strip
60AR       = ar
61NM       = nm
62RANLIB   = ranlib
63STRIP	 = strip
64GZIPPROG = gzip
65XZ	 = xz
66PNGTOPNM = pngtopnm
67MCOPY    = mcopy
68MFORMAT  = mformat
69MKISOFS  = mkisofs
70SED	 = sed
71WGET	 = wget
72
73com32    = $(topdir)/com32
74
75# Architecture definition
76SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) 
77# on x86_64, ARCH has trailing whitespace
78# strip white spaces in ARCH
79ARCH ?= $(strip $(SUBARCH))
80
81# Common warnings we want for all gcc-generated code
82GCCWARN  = -W -Wall -Wstrict-prototypes $(DEBUGOPT)
83
84# Common stanza to make gcc generate .*.d dependency files
85MAKEDEPS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d
86
87# Dependencies that exclude system headers; use whenever we use
88# header files from the platform.
89UMAKEDEPS = -Wp,-MT,$@,-MMD,$(dir $@).$(notdir $@).d
90
91# Items that are only appropriate during development; this file is
92# removed when tarballs are generated.
93-include $(MAKEDIR)/devel.mk
94
95# Local additions, like -DDEBUG can go here
96-include $(MAKEDIR)/local.mk
97