Adding upstream version 3.50~pre5.
[syslinux-debian/hramrach.git] / com32 / samples / Makefile
blobb694a489aa16345ea1a6bb7a2ec16eb39fef838f
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 2001-2004 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 all: hello.c32 cat.c32 resolv.c32 vesainfo.c32 \
42 fancyhello.c32 fancyhello.lnx \
43 keytest.c32 keytest.lnx \
45 .PRECIOUS: %.o
46 %.o: %.S
47 $(CC) $(SFLAGS) -c -o $@ $<
49 .PRECIOUS: %.o
50 %.o: %.c
51 $(CC) $(CFLAGS) -c -o $@ $<
53 .PRECIOUS: %.elf
54 %.elf: %.o $(LIBS)
55 $(LD) $(LDFLAGS) -o $@ $^
57 .PRECIOUS: %.lo
58 %.lo: %.S
59 $(CC) $(LNXSFLAGS) -c -o $@ $<
61 .PRECIOUS: %.lo
62 %.lo: %.c
63 $(CC) $(LNXCFLAGS) -c -o $@ $<
65 .PRECIOUS: %.lnx
66 %.lnx: %.lo $(LNXLIBS)
67 $(CC) $(LNXLDFLAGS) -o $@ $^
69 %.c32: %.elf
70 $(OBJCOPY) -O binary $< $@
72 tidy:
73 rm -f *.o *.lo *.a *.lst *.elf
75 clean: tidy
76 rm -f *.lss *.c32 *.lnx *.com
78 spotless: clean
79 rm -f *~ \#*
81 install: # Don't install samples