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 |
---|
18 | MAKEFLAGS += -r |
---|
19 | MAKE += -r |
---|
20 | |
---|
21 | BINDIR = /usr/bin |
---|
22 | SBINDIR = /sbin |
---|
23 | LIBDIR = /usr/lib |
---|
24 | DATADIR = /usr/share |
---|
25 | AUXDIR = $(DATADIR)/syslinux |
---|
26 | DIAGDIR = $(AUXDIR)/diag |
---|
27 | MANDIR = /usr/man |
---|
28 | INCDIR = /usr/include |
---|
29 | TFTPBOOT = /tftpboot |
---|
30 | COM32DIR = $(AUXDIR)/com32 |
---|
31 | |
---|
32 | BOOTDIR = /boot |
---|
33 | EXTLINUXDIR = $(BOOTDIR)/extlinux |
---|
34 | |
---|
35 | ifdef DEBUG |
---|
36 | # This allows DEBUGOPT to be set from the command line |
---|
37 | DEBUGOPT = -DDEBUG=$(DEBUG) |
---|
38 | endif |
---|
39 | |
---|
40 | NASM = nasm |
---|
41 | NASMOPT = -Ox $(DEBUGOPT) |
---|
42 | |
---|
43 | PERL = perl |
---|
44 | PYTHON = python |
---|
45 | UPX = upx |
---|
46 | |
---|
47 | CHMOD = chmod |
---|
48 | |
---|
49 | CC = gcc |
---|
50 | gcc_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 | |
---|
56 | LD = ld |
---|
57 | OBJDUMP = objdump |
---|
58 | OBJCOPY = objcopy |
---|
59 | STRIP = strip |
---|
60 | AR = ar |
---|
61 | NM = nm |
---|
62 | RANLIB = ranlib |
---|
63 | STRIP = strip |
---|
64 | GZIPPROG = gzip |
---|
65 | XZ = xz |
---|
66 | PNGTOPNM = pngtopnm |
---|
67 | MCOPY = mcopy |
---|
68 | MFORMAT = mformat |
---|
69 | MKISOFS = mkisofs |
---|
70 | SED = sed |
---|
71 | WGET = wget |
---|
72 | |
---|
73 | com32 = $(topdir)/com32 |
---|
74 | |
---|
75 | # Architecture definition |
---|
76 | SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) |
---|
77 | # on x86_64, ARCH has trailing whitespace |
---|
78 | # strip white spaces in ARCH |
---|
79 | ARCH ?= $(strip $(SUBARCH)) |
---|
80 | |
---|
81 | # Common warnings we want for all gcc-generated code |
---|
82 | GCCWARN = -W -Wall -Wstrict-prototypes $(DEBUGOPT) |
---|
83 | |
---|
84 | # Common stanza to make gcc generate .*.d dependency files |
---|
85 | MAKEDEPS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d |
---|
86 | |
---|
87 | # Dependencies that exclude system headers; use whenever we use |
---|
88 | # header files from the platform. |
---|
89 | UMAKEDEPS = -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 |
---|