Test program for the VESA code
[syslinux.git] / sample / Makefile
blobb92f820b0ed6e456a4a20f57d90a6963db22573e
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,-ffreestanding,)
22 CC = gcc $(M32)
23 LD = ld -m elf_i386
24 AR = ar
25 NASM = nasm
26 RANLIB = ranlib
27 CFLAGS = -W -Wall -march=i386 -Os -fomit-frame-pointer -I../com32/include
28 SFLAGS = -march=i386
29 LDFLAGS = -s
30 OBJCOPY = objcopy
31 PPMTOLSS16 = ../ppmtolss16
32 LIB = liboldcom32.a
34 LIBOBJS = conio.o atou.o skipatou.o printf.o c32exit.o
36 .SUFFIXES: .lss .c .o .elf .c32
38 all: syslogo.lss comecho.com hello.c32 hello2.c32 filetest.c32 c32echo.c32 \
39 fd.c32 $(LIB)
41 .PRECIOUS: %.o
42 %.o: %.S
43 $(CC) $(SFLAGS) -c -o $@ $<
45 .PRECIOUS: %.o
46 %.o: %.c
47 $(CC) $(CFLAGS) -c -o $@ $<
49 .PRECIOUS: %.elf
50 %.elf: c32entry.o %.o $(LIB)
51 $(LD) -Ttext 0x101000 -e _start -o $@ $^
53 %.c32: %.elf
54 $(OBJCOPY) -O binary $< $@
56 %.com: %.asm
57 $(NASM) -f bin -o $@ -l $*.lst $<
59 $(LIB): $(LIBOBJS)
60 rm -f $@
61 $(AR) cq $@ $^
62 $(RANLIB) $@
64 syslogo.lss: syslogo.png $(PPMTOLSS16)
65 pngtopnm syslogo.png | \
66 $(PPMTOLSS16) \#000000=0 \#d0d0d0=7 \#f6f6f6=15 \
67 > syslogo.lss
69 tidy:
70 rm -f *.o *.a *.lst *.elf
72 # Don't specify *.com since mdiskchk.com can't be built using Linux tools
73 clean: tidy
74 rm -f *.lss *.o *.c32 comecho.com
76 spotless: clean