Use CC for CC_FOR_BUILD when unspecified.
[syslinux.git] / utils / Makefile
blob330e20269f52fc9dba6c53d8d8ee2aa514e5dbe3
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.
11 ## -----------------------------------------------------------------------
14 # SYSLINUX utilities
17 VPATH = $(SRC)
18 include $(MAKEDIR)/syslinux.mk
20 CC_FOR_BUILD ?= $(CC)
22 CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC)
23 LDFLAGS = -O2
25 C_TARGETS = isohybrid gethostip memdiskfind
26 SCRIPT_TARGETS = mkdiskimage
27 SCRIPT_TARGETS += isohybrid.pl # about to be obsoleted
28 ASIS = $(addprefix $(SRC)/,keytab-lilo lss16toppm md5pass \
29 ppmtolss16 sha1pass syslinux2ansi pxelinux-options)
31 TARGETS = $(C_TARGETS) $(SCRIPT_TARGETS)
33 ISOHDPFX = $(addprefix $(OBJ)/,../mbr/isohdpfx.bin ../mbr/isohdpfx_f.bin \
34 ../mbr/isohdpfx_c.bin \
35 ../mbr/isohdppx.bin ../mbr/isohdppx_f.bin ../mbr/isohdppx_c.bin)
37 all: $(TARGETS)
39 %.o: %.c
40 $(CC) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
42 mkdiskimage: mkdiskimage.in ../mbr/mbr.bin bin2hex.pl
43 $(PERL) $(SRC)/bin2hex.pl < $(OBJ)/../mbr/mbr.bin | cat $(SRC)/mkdiskimage.in - > $@
44 chmod a+x $@
46 # Works on anything with a Perl interpreter...
47 isohybrid.pl: isohybrid.in $(ISOHDPFX) bin2hex.pl
48 cp -f $(SRC)/isohybrid.in $@
49 for f in $(ISOHDPFX) ; do $(PERL) $(SRC)/bin2hex.pl < $$f >> $@ ; done
50 chmod a+x $@
52 isohdpfx.c: $(ISOHDPFX) isohdpfxarray.pl
53 $(PERL) $(SRC)/isohdpfxarray.pl $(ISOHDPFX) > $@
55 isohybrid: isohybrid.o isohdpfx.o
56 $(CC) $(LDFLAGS) -o $@ $^ -luuid
58 gethostip: gethostip.o
59 $(CC) $(LDFLAGS) -o $@ $^
61 memdiskfind: memdiskfind.o
62 $(CC) $(LDFLAGS) -o $@ $^
64 tidy dist:
65 rm -f *.o .*.d isohdpfx.c
67 clean: tidy
68 rm -f $(TARGETS)
70 spotless: clean
72 installer: all
74 install: installer
75 mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
76 install -m 755 $(TARGETS) $(ASIS) $(INSTALLROOT)$(BINDIR)
78 strip:
79 $(STRIP) $(C_TARGETS)
81 -include .*.d