syslinux-3.08-2 sources from FC4
[bootcd.git] / syslinux / win32 / Makefile
1 ## $Id: Makefile,v 1.12 2004/12/22 17:53:54 hpa Exp $
2 ## -----------------------------------------------------------------------
3 ##   
4 ##   Copyright 1998-2004 H. Peter Anvin - All Rights Reserved
5 ##
6 ##   This program is free software; you can redistribute it and/or modify
7 ##   it under the terms of the GNU General Public License as published by
8 ##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 ##   Boston MA 02111-1307, USA; either version 2 of the License, or
10 ##   (at your option) any later version; incorporated herein by reference.
11 ##
12 ## -----------------------------------------------------------------------
13
14 #
15 # Makefile for SYSLINUX Win32
16 #
17 # This is separated out mostly so we can have a different set of Makefile
18 # variables.
19 #
20
21 OSTYPE   = $(shell uname -msr)
22 ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN)
23 CC       = gcc
24 AR       = ar
25 RANLIB   = ranlib
26 CFLAGS   = -mno-cygwin -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
27 PIC      =
28 LDFLAGS  = -mno-cygwin -Os -s
29 else
30 ifeq ($(findstring MINGW32,$(OSTYPE)),MINGW32)
31 CC       = gcc
32 AR       = ar
33 RANLIB   = ranlib
34 else
35 CC       = mingw-gcc
36 AR       = mingw-ar
37 RANLIB   = mingw-ranlib
38 endif
39
40 CFLAGS   = -W -Wall -Wno-sign-compare -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
41 PIC      =
42 LDFLAGS  = -Os -s
43 endif
44 CFLAGS += -I. -I.. -I../libfat
45
46 CC_IS_GOOD := $(shell $(CC) $(CFLAGS) $(LDFLAGS) -o hello.exe hello.c >/dev/null 2>&1 ; echo $$?)
47
48 .SUFFIXES: .c .o .i .s .S
49
50 SRCS     = syslinux.c ../syslxmod.c ../bootsect_bin.c ../ldlinux_bin.c \
51            ../mbr_bin.c $(wildcard ../libfat/*.c)
52 OBJS     = $(patsubst %.c,%.o,$(notdir $(SRCS)))
53
54 VPATH = .:..:../libfat
55
56 TARGETS = syslinux.exe
57
58 ifeq ($(CC_IS_GOOD),0)
59 all: $(TARGETS)
60 else
61 all:
62         rm -f $(TARGETS)
63 endif
64
65 tidy:
66         -rm -f *.o *.i *.s *.a .*.d *_bin.c
67
68 clean: tidy
69
70 spotless: clean
71         -rm -f *~ $(TARGETS)
72
73 installer:
74
75 syslinux.exe: $(OBJS)
76         $(CC) $(LDFLAGS) -o $@ $^
77
78
79 %.o: %.c
80         $(CC) -Wp,-MT,$@,-MMD,.$@.d $(CFLAGS) -c -o $@ $<
81 %.i: %.c
82         $(CC) $(CFLAGS) -E -o $@ $<
83 %.s: %.c
84         $(CC) $(CFLAGS) -S -o $@ $<
85
86 -include .*.d