ifcpu64.c32: clean up the sources
[syslinux.git] / sample / Makefile
blobd10b5ed1ff5a7f79b6c0ebd0569de2f744ef4ddc
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 CC = gcc
21 gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
22 then echo $(1); else echo $(2); fi; rm -f $$tmpf)
24 M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,)
26 LD = ld -m elf_i386
27 AR = ar
28 NASM = nasm
29 NASMOPT = -O9999
30 RANLIB = ranlib
31 CFLAGS = $(M32) -W -Wall -march=i386 -Os -fomit-frame-pointer -I../com32/include
32 SFLAGS = $(M32) -march=i386
33 LDFLAGS = -s
34 OBJCOPY = objcopy
35 PPMTOLSS16 = ../utils/ppmtolss16
36 LIB = liboldcom32.a
37 GZIPPROG = gzip
38 PNGTOPNM = pngtopnm
40 LIBOBJS = conio.o atou.o skipatou.o printf.o c32exit.o
42 .SUFFIXES: .lss .c .o .elf .c32
44 all: syslogo.lss comecho.com hello.c32 hello2.c32 filetest.c32 c32echo.c32 \
45 fd.c32 $(LIB)
47 .PRECIOUS: %.o
48 %.o: %.S
49 $(CC) $(SFLAGS) -c -o $@ $<
51 .PRECIOUS: %.o
52 %.o: %.c
53 $(CC) $(CFLAGS) -c -o $@ $<
55 .PRECIOUS: %.elf
56 %.elf: c32entry.o %.o $(LIB)
57 $(LD) -Ttext 0x101000 -e _start -o $@ $^
59 %.c32: %.elf
60 $(OBJCOPY) -O binary $< $@
62 %.com: %.asm
63 $(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
65 $(LIB): $(LIBOBJS)
66 rm -f $@
67 $(AR) cq $@ $^
68 $(RANLIB) $@
70 %.lss: %.ppm.gz $(PPMTOLSS16)
71 $(GZIPPROG) -cd $< | \
72 $(PPMTOLSS16) \#000000=0 \#d0d0d0=7 \#f6f6f6=15 \
73 > $@
75 %.ppm.gz: %.png
76 $(PNGTOPNM) $< | gzip -9 > $@
78 tidy dist:
79 rm -f *.o *.a *.lst *.elf
81 # Don't specify *.com since mdiskchk.com can't be built using Linux tools
82 clean: tidy
83 rm -f *.lss *.o *.c32 comecho.com
85 spotless: clean