Adding upstream version 3.61+dfsg.
[syslinux-debian/hramrach.git] / com32 / modules / Makefile
blob0347c17c56319e8c9679d3f1d80d56b59753bb4f
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 ## 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 NASMOPT = -O9999
29 RANLIB = ranlib
30 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I../libutil/include -I../include -D__COM32__
31 LNXCFLAGS = -W -Wall -O -g -I../libutil/include
32 LNXSFLAGS = -g
33 LNXLDFLAGS = -g
34 SFLAGS = -D__COM32__ -march=i386
35 LDFLAGS = -T ../lib/com32.ld
36 OBJCOPY = objcopy
37 PPMTOLSS16 = ../ppmtolss16
38 LIBGCC := $(shell $(CC) --print-libgcc)
39 LIBS = ../libutil/libutil_com.a ../lib/libcom32.a $(LIBGCC)
40 LNXLIBS = ../libutil/libutil_lnx.a
42 .SUFFIXES: .lss .c .o .elf .c32 .lnx
44 BINDIR = /usr/bin
45 LIBDIR = /usr/lib
46 AUXDIR = $(LIBDIR)/syslinux
47 INCDIR = /usr/include
48 COM32DIR = $(AUXDIR)/com32
50 MODULES = chain.c32 menu.c32 vesamenu.c32 ethersel.c32 mboot.c32 \
51 dmitest.c32 cpuidtest.c32 pcitest.c32 elf.c32 linux.c32 \
52 reboot.c32 pmload.c32 meminfo.c32
53 TESTFILES =
55 all: $(MODULES) $(TESTFILES)
57 .PRECIOUS: %.o
58 %.o: %.S
59 $(CC) $(SFLAGS) -c -o $@ $<
61 .PRECIOUS: %.o
62 %.o: %.c
63 $(CC) $(CFLAGS) -c -o $@ $<
65 .PRECIOUS: %.elf
66 %.elf: %.o $(LIBS)
67 $(LD) $(LDFLAGS) -o $@ $^
69 .PRECIOUS: %.lo
70 %.lo: %.S
71 $(CC) $(LNXSFLAGS) -c -o $@ $<
73 .PRECIOUS: %.lo
74 %.lo: %.c
75 $(CC) $(LNXCFLAGS) -c -o $@ $<
77 .PRECIOUS: %.lnx
78 %.lnx: %.lo $(LNXLIBS)
79 $(CC) $(LNXLDFLAGS) -o $@ $^
81 %.c32: %.elf
82 $(OBJCOPY) -O binary $< $@
84 pcitest.elf : pcitest.o $(LIBS)
85 $(LD) $(LDFLAGS) -o $@ $^
87 cpuidtest.elf : cpuidtest.o cpuid.o $(LIBS)
88 $(LD) $(LDFLAGS) -o $@ $^
90 dmitest.elf : dmitest.o dmi_utils.o dmi.o $(LIBS)
91 $(LD) $(LDFLAGS) -o $@ $^
93 menu.elf : menu.o menumain.o readconfig.o printmsg.o $(LIBS)
94 $(LD) $(LDFLAGS) -o $@ $^
96 vesamenu.elf : vesamenu.o menumain.o readconfig.o printmsg.o $(LIBS)
97 $(LD) $(LDFLAGS) -o $@ $^
99 ethersel.elf : ethersel.o $(LIBS)
100 $(LD) $(LDFLAGS) -o $@ $^
102 menu.lnx : menu.lo readconfig.lo $(LNXLIBS)
103 $(CC) $(LNXLDFLAGS) -o $@ $^
105 tidy:
106 rm -f *.o *.lo *.a *.lst *.elf
108 clean: tidy
109 rm -f *.lss *.c32 *.lnx *.com
111 spotless: clean
112 rm -f *~ \#*
114 install: all
115 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
116 install -m 644 $(MODULES) $(INSTALLROOT)$(AUXDIR)