Adding upstream version 3.51.
[syslinux-debian/hramrach.git] / com32 / modules / Makefile
blobb83a65cb6f0ce454175aeb9b82fd97b36bd1b737
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 2001-2006 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 ## samples for syslinux users
17 TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
19 gcc_ok = $(shell tmpf=$(TMPFILE); if gcc $(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 RANLIB = ranlib
29 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I../libutil/include -I../include -D__COM32__
30 LNXCFLAGS = -W -Wall -O -g -I../libutil/include
31 LNXSFLAGS = -g
32 LNXLDFLAGS = -g
33 SFLAGS = -D__COM32__ -march=i386
34 LDFLAGS = -T ../lib/com32.ld
35 OBJCOPY = objcopy
36 PPMTOLSS16 = ../ppmtolss16
37 LIBGCC := $(shell $(CC) --print-libgcc)
38 LIBS = ../libutil/libutil_com.a ../lib/libcom32.a $(LIBGCC)
39 LNXLIBS = ../libutil/libutil_lnx.a
41 .SUFFIXES: .lss .c .o .elf .c32 .lnx
43 BINDIR = /usr/bin
44 LIBDIR = /usr/lib
45 AUXDIR = $(LIBDIR)/syslinux
46 INCDIR = /usr/include
47 COM32DIR = $(AUXDIR)/com32
49 MODULES = chain.c32 menu.c32 vesamenu.c32 ethersel.c32 mboot.c32 \
50 dmitest.c32 cpuidtest.c32 pcitest.c32 elf.c32 linux.c32
51 TESTFILES =
53 all: $(MODULES) $(TESTFILES)
55 .PRECIOUS: %.o
56 %.o: %.S
57 $(CC) $(SFLAGS) -c -o $@ $<
59 .PRECIOUS: %.o
60 %.o: %.c
61 $(CC) $(CFLAGS) -c -o $@ $<
63 .PRECIOUS: %.elf
64 %.elf: %.o $(LIBS)
65 $(LD) $(LDFLAGS) -o $@ $^
67 .PRECIOUS: %.lo
68 %.lo: %.S
69 $(CC) $(LNXSFLAGS) -c -o $@ $<
71 .PRECIOUS: %.lo
72 %.lo: %.c
73 $(CC) $(LNXCFLAGS) -c -o $@ $<
75 .PRECIOUS: %.lnx
76 %.lnx: %.lo $(LNXLIBS)
77 $(CC) $(LNXLDFLAGS) -o $@ $^
79 %.c32: %.elf
80 $(OBJCOPY) -O binary $< $@
82 pcitest.elf : pcitest.o $(LIBS)
83 $(LD) $(LDFLAGS) -o $@ $^
85 cpuidtest.elf : cpuidtest.o cpuid.o $(LIBS)
86 $(LD) $(LDFLAGS) -o $@ $^
88 dmitest.elf : dmitest.o dmi_utils.o dmi.o $(LIBS)
89 $(LD) $(LDFLAGS) -o $@ $^
91 menu.elf : menu.o menumain.o readconfig.o printmsg.o $(LIBS)
92 $(LD) $(LDFLAGS) -o $@ $^
94 vesamenu.elf : vesamenu.o menumain.o readconfig.o printmsg.o $(LIBS)
95 $(LD) $(LDFLAGS) -o $@ $^
97 ethersel.elf : ethersel.o $(LIBS)
98 $(LD) $(LDFLAGS) -o $@ $^
100 menu.lnx : menu.lo readconfig.lo $(LNXLIBS)
101 $(CC) $(LNXLDFLAGS) -o $@ $^
103 tidy:
104 rm -f *.o *.lo *.a *.lst *.elf
106 clean: tidy
107 rm -f *.lss *.c32 *.lnx *.com
109 spotless: clean
110 rm -f *~ \#*
112 install: all
113 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
114 install -m 644 $(MODULES) $(INSTALLROOT)$(AUXDIR)