gPXE SAN boot module
[syslinux.git] / com32 / modules / Makefile
blob8a8827e5167af04e8d60f9918b5335b3bc5bffec
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.
11 ## -----------------------------------------------------------------------
14 ## COM32 standard modules
17 TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
19 gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
20 then echo $(1); else echo $(2); fi; rm -f $$tmpf)
22 M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,)
24 CC = gcc
25 LD = ld -m elf_i386
26 AR = ar
27 NASM = nasm
28 NASMOPT = -O9999
29 RANLIB = ranlib
30 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os \
31 -fomit-frame-pointer -D__COM32__ \
32 -nostdinc -iwithprefix include \
33 -I../libutil/include -I../include \
34 -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d
35 LNXCFLAGS = -W -Wall -O -g -I../libutil/include
36 LNXSFLAGS = -g
37 LNXLDFLAGS = -g
38 SFLAGS = -D__COM32__ -march=i386
39 LDFLAGS = -T ../lib/com32.ld
40 OBJCOPY = objcopy
41 PPMTOLSS16 = ../ppmtolss16
42 LIBGCC := $(shell $(CC) --print-libgcc)
43 LIBS = ../libutil/libutil_com.a ../lib/libcom32.a $(LIBGCC)
44 LNXLIBS = ../libutil/libutil_lnx.a
46 .SUFFIXES: .lss .c .o .elf .c32 .lnx
48 BINDIR = /usr/bin
49 LIBDIR = /usr/lib
50 AUXDIR = $(LIBDIR)/syslinux
51 INCDIR = /usr/include
52 COM32DIR = $(AUXDIR)/com32
54 MODULES = chain.c32 ethersel.c32 mboot.c32 dmitest.c32 cpuidtest.c32 \
55 pcitest.c32 elf.c32 linux.c32 reboot.c32 pmload.c32 meminfo.c32 \
56 sanboot.c32
57 TESTFILES =
59 all: $(MODULES) $(TESTFILES)
61 .PRECIOUS: %.o
62 %.o: %.S
63 $(CC) $(SFLAGS) -c -o $@ $<
65 .PRECIOUS: %.o
66 %.o: %.c
67 $(CC) $(CFLAGS) -c -o $@ $<
69 .PRECIOUS: %.elf
70 %.elf: %.o $(LIBS)
71 $(LD) $(LDFLAGS) -o $@ $^
73 .PRECIOUS: %.lo
74 %.lo: %.S
75 $(CC) $(LNXSFLAGS) -c -o $@ $<
77 .PRECIOUS: %.lo
78 %.lo: %.c
79 $(CC) $(LNXCFLAGS) -c -o $@ $<
81 .PRECIOUS: %.lnx
82 %.lnx: %.lo $(LNXLIBS)
83 $(CC) $(LNXLDFLAGS) -o $@ $^
85 %.c32: %.elf
86 $(OBJCOPY) -O binary $< $@
88 pcitest.elf : pcitest.o $(LIBS)
89 $(LD) $(LDFLAGS) -o $@ $^
91 cpuidtest.elf : cpuidtest.o cpuid.o $(LIBS)
92 $(LD) $(LDFLAGS) -o $@ $^
94 dmitest.elf : dmitest.o dmi_utils.o dmi.o $(LIBS)
95 $(LD) $(LDFLAGS) -o $@ $^
97 ethersel.elf : ethersel.o $(LIBS)
98 $(LD) $(LDFLAGS) -o $@ $^
100 tidy:
101 rm -f *.o *.lo *.a *.lst *.elf .*.d
103 clean: tidy
104 rm -f *.lss *.c32 *.lnx *.com
106 spotless: clean
107 rm -f *~ \#*
109 install: all
110 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
111 install -m 644 $(MODULES) $(INSTALLROOT)$(AUXDIR)
113 -include .*.d