fe60793c5938d0c8c9bbf05bc5de772cb54eb054
[profile/ivi/syslinux.git] / win64 / Makefile
1 ## -----------------------------------------------------------------------
2 ##
3 ##   Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
4 ##   Copyright 2010 Intel Corporation; author: H. Peter Anvin
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 Win64
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 # Don't know how to do a native compile here...
23 WINPREFIX  := $(shell ./find-mingw64.sh gcc)
24 WINCFLAGS  := $(GCCWARN) -Wno-sign-compare -Os -fomit-frame-pointer \
25               -D_FILE_OFFSET_BITS=64
26 WINLDFLAGS := -Os -s
27
28 WINCFLAGS += -I. -I../win -I.. -I../libfat -I../libinstaller \
29              -I../libinstaller/getopt
30
31 WINCC      := $(WINPREFIX)gcc
32 WINAR      := $(WINPREFIX)ar
33 WINRANLIB  := $(WINPREFIX)ranlib
34
35 WINCC_IS_GOOD := $(shell $(WINCC) $(WINCFLAGS) $(WINLDFLAGS) \
36         -o hello.exe ../win/hello.c >/dev/null 2>&1 ; echo $$?)
37
38 .SUFFIXES: .c .obj .lib .exe .i .s .S
39
40 SRCS     = ../win/syslinux.c ../win/ntfssect.c
41 OBJS     = $(patsubst %.c,%.obj,$(notdir $(SRCS)))
42 LIBSRC   = ../libinstaller/fs.c \
43            ../libinstaller/syslxmod.c \
44            ../libinstaller/syslxopt.c \
45            ../libinstaller/setadv.c \
46            ../libinstaller/getopt/getopt_long.c \
47            ../libinstaller/bootsect_bin.c \
48            ../libinstaller/ldlinux_bin.c \
49            ../libinstaller/mbr_bin.c \
50            $(wildcard ../libfat/*.c)
51 LIBOBJS  = $(patsubst %.c,%.obj,$(notdir $(LIBSRC)))
52
53 LIB      = syslinux.lib
54
55 VPATH = .:../win:../libfat:../libinstaller:../libinstaller/getopt
56
57 TARGETS = syslinux64.exe
58
59 ifeq ($(WINCC_IS_GOOD),0)
60 all: $(TARGETS)
61 else
62 all:
63         rm -f $(TARGETS)
64 endif
65
66 tidy dist:
67         -rm -f *.o *.obj *.lib *.i *.s *.a .*.d *.tmp *_bin.c hello.exe
68
69 clean: tidy
70
71 spotless: clean
72         -rm -f *~ $(TARGETS)
73
74 installer:
75
76 $(LIB): $(LIBOBJS)
77         rm -f $@
78         $(WINAR) cq $@ $^
79         $(WINRANLIB) $@
80
81 syslinux64.exe: $(OBJS) $(LIB)
82         $(WINCC) $(WINLDFLAGS) -o $@ $^
83
84
85 %.obj: %.c
86         $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -c -o $@ $<
87 %.i: %.c
88         $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -E -o $@ $<
89 %.s: %.c
90         $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -S -o $@ $<
91
92 -include .*.d *.tmp