Adding upstream version 3.50~pre5.
[syslinux-debian/hramrach.git] / com32 / modules / Makefile
blobbef45a87f2be2736d31ac82728645d9be658651f
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 gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
18 then echo $(1); else echo $(2); fi)
20 M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,)
22 CC = gcc
23 LD = ld -m elf_i386
24 AR = ar
25 NASM = nasm
26 RANLIB = ranlib
27 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I../libutil/include -I../include -D__COM32__
28 LNXCFLAGS = -W -Wall -O -g -I../libutil/include
29 LNXSFLAGS = -g
30 LNXLDFLAGS = -g
31 SFLAGS = -D__COM32__ -march=i386
32 LDFLAGS = -T ../lib/com32.ld
33 OBJCOPY = objcopy
34 PPMTOLSS16 = ../ppmtolss16
35 LIBGCC := $(shell $(CC) --print-libgcc)
36 LIBS = ../libutil/libutil_com.a ../lib/libcom32.a $(LIBGCC)
37 LNXLIBS = ../libutil/libutil_lnx.a
39 .SUFFIXES: .lss .c .o .elf .c32 .lnx
41 BINDIR = /usr/bin
42 LIBDIR = /usr/lib
43 AUXDIR = $(LIBDIR)/syslinux
44 INCDIR = /usr/include
45 COM32DIR = $(AUXDIR)/com32
47 MODULES = chain.c32 menu.c32 vesamenu.c32 ethersel.c32 mboot.c32 \
48 dmitest.c32 cpuidtest.c32 pcitest.c32 elf.c32 linux.c32
49 TESTFILES =
51 all: $(MODULES) $(TESTFILES)
53 .PRECIOUS: %.o
54 %.o: %.S
55 $(CC) $(SFLAGS) -c -o $@ $<
57 .PRECIOUS: %.o
58 %.o: %.c
59 $(CC) $(CFLAGS) -c -o $@ $<
61 .PRECIOUS: %.elf
62 %.elf: %.o $(LIBS)
63 $(LD) $(LDFLAGS) -o $@ $^
65 .PRECIOUS: %.lo
66 %.lo: %.S
67 $(CC) $(LNXSFLAGS) -c -o $@ $<
69 .PRECIOUS: %.lo
70 %.lo: %.c
71 $(CC) $(LNXCFLAGS) -c -o $@ $<
73 .PRECIOUS: %.lnx
74 %.lnx: %.lo $(LNXLIBS)
75 $(CC) $(LNXLDFLAGS) -o $@ $^
77 %.c32: %.elf
78 $(OBJCOPY) -O binary $< $@
80 pcitest.elf : pcitest.o $(LIBS)
81 $(LD) $(LDFLAGS) -o $@ $^
83 cpuidtest.elf : cpuidtest.o cpuid.o $(LIBS)
84 $(LD) $(LDFLAGS) -o $@ $^
86 dmitest.elf : dmitest.o dmi_utils.o dmi.o $(LIBS)
87 $(LD) $(LDFLAGS) -o $@ $^
89 menu.elf : menu.o menumain.o readconfig.o $(LIBS)
90 $(LD) $(LDFLAGS) -o $@ $^
92 vesamenu.elf : vesamenu.o menumain.o readconfig.o $(LIBS)
93 $(LD) $(LDFLAGS) -o $@ $^
95 ethersel.elf : ethersel.o $(LIBS)
96 $(LD) $(LDFLAGS) -o $@ $^
98 menu.lnx : menu.lo readconfig.lo $(LNXLIBS)
99 $(CC) $(LNXLDFLAGS) -o $@ $^
101 tidy:
102 rm -f *.o *.lo *.a *.lst *.elf
104 clean: tidy
105 rm -f *.lss *.c32 *.lnx *.com
107 spotless: clean
108 rm -f *~ \#*
110 install: all
111 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
112 install -m 644 $(MODULES) $(INSTALLROOT)$(AUXDIR)