Adding upstream version 3.50~pre5.
[syslinux-debian/hramrach.git] / menu / Makefile
blobcee1c3af11ec291fc1314c308f2f824455db41fa
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 2001-2005 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 COM32DIR = ../com32
28 LUDIR = $(COM32DIR)/libutil
29 LDIR = $(COM32DIR)/lib
30 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I$(LUDIR)/include -I$(COM32DIR)/include -Ilibmenu -D__COM32__
31 SFLAGS = -D__COM32__ -march=i386
32 LDFLAGS = -T $(LDIR)/com32.ld
33 OBJCOPY = objcopy
34 LIBGCC := $(shell $(CC) --print-libgcc)
36 LIBS = libmenu/libmenu.a $(LUDIR)/libutil_com.a $(LDIR)/libcom32.a $(LIBGCC)
38 LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
39 libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
41 CMENUS = $(patsubst %.c,%.c32,$(wildcard *.c))
42 IMENUS = $(patsubst %.menu,%.c32,$(wildcard *.menu))
44 MENUS = $(CMENUS) $(IMENUS)
46 .SUFFIXES: .S .c .o .elf .c32 .menu
48 .PRECIOUS: %.c
49 %.c: %.menu adv_menu.tpl
50 python menugen.py --input=$< --output=$@ --template=adv_menu.tpl
52 .PRECIOUS: %.o
53 %.o: %.S
54 $(CC) $(SFLAGS) -c -o $@ $<
56 .PRECIOUS: %.o
57 %.o: %.c %.h
58 $(CC) $(CFLAGS) -c -o $@ $<
60 .PRECIOUS: %.elf
61 %.elf: %.o $(LIBS)
62 $(LD) $(LDFLAGS) -o $@ $^
64 %.c32: %.elf
65 $(OBJCOPY) -O binary $< $@
67 all: menus
69 libmenu/libmenu.a: $(LIBMENU)
70 -rm -f $@
71 $(AR) cq $@ $^
72 $(RANLIB) $@
74 tidy:
75 rm -f *.o *.lo *.a *.lst *.elf
77 libclean:
78 rm -f libmenu/*.o libmenu/*.a
80 clean: tidy menuclean
81 rm -f *.lss *.c32 *.com
83 menuclean:
84 rm -f $(patsubst %.menu,%.c,$(wildcard *.menu))
86 spotless: clean libclean menuclean
87 rm -f *~ \#*
89 menus: $(MENUS)
91 install: # Don't install samples