Move files out of root into core, dos, and utils
[profile/ivi/syslinux.git] / utils / Makefile
1 ## -----------------------------------------------------------------------
2 ##
3 ##   Copyright 1998-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 # SYSLINUX utilities
15 #
16 # No builtin rules
17 MAKEFLAGS += -r
18 MAKE      += -r
19
20 TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
21
22 CC       = gcc
23
24 gcc_ok   = $(shell tmpf=$(TMPFILE); if $(CC) $(1) dummy.c -o $$tmpf 2>/dev/null; \
25                    then echo '$(1)'; else echo '$(2)'; fi; rm -f $$tmpf)
26
27 comma   := ,
28 LDHASH  := $(call gcc_ok,-Wl$(comma)--hash-style=both,)
29
30 CFLAGS   = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
31 LDFLAGS  = -O2 -s $(LDHASH)
32 LD       = ld
33 PERL     = perl
34
35 TARGETS  = mkdiskimage gethostip
36 ASIS     = keytab-lilo lss16toppm md5pass ppmtolss16 sha1pass syslinux2ansi
37
38 all: mkdiskimage gethostip
39
40 %.o: %.c
41         $(CC) $(CFLAGS) -c -o $@ $<
42
43 mkdiskimage: mkdiskimage.in ../mbr/mbr.bin bin2hex.pl
44         $(PERL) bin2hex.pl < ../mbr/mbr.bin | cat mkdiskimage.in - > $@
45         chmod a+x $@
46
47 gethostip: gethostip.o
48         $(CC) $(LDFLAGS) -o $@ $^
49
50 tidy dist:
51         rm -f *.o
52
53 clean: tidy
54         rm -f $(TARGETS)
55
56 spotless: clean
57
58 installer: all