chain.c32: minor stylistic cleanup
[syslinux.git] / menu / Makefile
blob04d2e225fc1d83f57bf6a7f285995fd2e3e8699f
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 $(CC) $(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 COM32DIR = ../com32
31 LUDIR = $(COM32DIR)/libutil
32 LDIR = $(COM32DIR)/lib
33 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I$(LUDIR)/include -I$(COM32DIR)/include -Ilibmenu -D__COM32__
34 SFLAGS = -D__COM32__ -march=i386
35 LDFLAGS = -T $(LDIR)/com32.ld
36 OBJCOPY = objcopy
37 LIBGCC := $(shell $(CC) --print-libgcc)
39 LIBS = libmenu/libmenu.a $(LUDIR)/libutil_com.a $(LDIR)/libcom32.a $(LIBGCC)
41 LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
42 libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
44 CMENUS = $(patsubst %.c,%.c32,$(wildcard *.c))
45 IMENUS = $(patsubst %.menu,%.c32,$(wildcard *.menu))
47 MENUS = $(CMENUS) $(IMENUS)
49 .SUFFIXES: .S .c .o .elf .c32 .menu
51 .PRECIOUS: %.c
52 %.c: %.menu adv_menu.tpl
53 python menugen.py --input=$< --output=$@ --template=adv_menu.tpl
55 .PRECIOUS: %.o
56 %.o: %.S
57 $(CC) $(SFLAGS) -c -o $@ $<
59 .PRECIOUS: %.o
60 %.o: %.c %.h
61 $(CC) $(CFLAGS) -c -o $@ $<
63 .PRECIOUS: %.elf
64 %.elf: %.o $(LIBS)
65 $(LD) $(LDFLAGS) -o $@ $^
67 %.c32: %.elf
68 $(OBJCOPY) -O binary $< $@
70 all: menus
72 libmenu/libmenu.a: $(LIBMENU)
73 -rm -f $@
74 $(AR) cq $@ $^
75 $(RANLIB) $@
77 tidy dist:
78 rm -f *.o *.lo *.a *.lst *.elf
80 libclean:
81 rm -f libmenu/*.o libmenu/*.a
83 clean: tidy menuclean
84 rm -f *.lss *.c32 *.com
86 menuclean:
87 rm -f $(patsubst %.menu,%.c,$(wildcard *.menu))
89 spotless: clean libclean menuclean
90 rm -f *~ \#*
92 menus: $(MENUS)
94 install: # Don't install samples