Major Makefile cleanups; gcc 4.3.0 compatiblity
[profile/ivi/syslinux.git] / extlinux / Makefile
1 ## -----------------------------------------------------------------------
2 ##
3 ##   Copyright 2001-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., 53 Temple Place Ste 330,
8 ##   Boston MA 02111-1307, USA; either version 2 of the License, or
9 ##   (at your option) any later version; incorporated herein by reference.
10 ##
11 ## -----------------------------------------------------------------------
12
13 ##
14 ## Linux ext2/ext3 installer
15 ##
16
17 topdir = ..
18 include $(topdir)/MCONFIG
19
20 OPTFLAGS = -g -Os
21 INCLUDES = -I. -I.. -I../libinstaller
22 CFLAGS   = -W -Wall -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
23            $(OPTFLAGS) $(INCLUDES)
24 LDFLAGS  = # -s
25
26 SRCS     = main.c \
27            ../libinstaller/setadv.c \
28            ../libinstaller/extlinux_bss_bin.c \
29            ../libinstaller/extlinux_sys_bin.c
30 OBJS     = $(patsubst %.c,%.o,$(notdir $(SRCS)))
31
32 .SUFFIXES: .c .o .i .s .S
33
34 VPATH = .:../libinstaller
35
36 all: installer
37
38 tidy dist:
39         -rm -f *.o *.i *.s *.a .*.d *.tmp
40
41 clean: tidy
42         -rm -f extlinux
43
44 spotless: clean
45         -rm -f *~
46
47 installer: extlinux
48
49 extlinux: $(OBJS)
50         $(CC) $(LDFLAGS) -o $@ $^
51
52 %.o: %.c
53         $(CC) -Wp,-MT,$@,-MMD,.$@.d $(CFLAGS) -c -o $@ $<
54 %.i: %.c
55         $(CC) $(CFLAGS) -E -o $@ $<
56 %.s: %.c
57         $(CC) $(CFLAGS) -S -o $@ $<
58
59 -include .*.d *.tmp