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 Win32 16# 17# This is separated out mostly so we can have a different set of Makefile 18# variables. 19# 20 21OSTYPE = $(shell uname -msr) 22ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN) 23## Compiling on Cygwin 24WINPREFIX := 25WINCFLAGS := -mno-cygwin $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 26WINLDFLAGS := -mno-cygwin -Os -s 27else 28## Compiling on some variant of MinGW 29ifeq ($(findstring MINGW32,$(OSTYPE)),MINGW32) 30WINPREFIX := 31else 32WINPREFIX := $(shell $(SRC)/find-mingw32.sh gcc) 33endif 34WINCFLAGS := $(GCCWARN) -Wno-sign-compare -Os -fomit-frame-pointer \ 35 -D_FILE_OFFSET_BITS=64 36WINLDFLAGS := -Os -s 37endif 38WINCFLAGS += -I$(SRC) -I$(SRC)/../win -I$(objdir) \ 39 -I$(SRC)/../libfat -I$(SRC)/../libinstaller \ 40 -I$(SRC)/../libinstaller/getopt 41 42WINCC := $(WINPREFIX)gcc 43WINAR := $(WINPREFIX)ar 44WINRANLIB := $(WINPREFIX)ranlib 45 46WINCC_IS_GOOD := $(shell $(WINCC) $(WINCFLAGS) $(WINLDFLAGS) \ 47 -o hello.exe $(SRC)/../win/hello.c >/dev/null 2>&1 ; echo $$?) 48 49.SUFFIXES: .c .obj .lib .exe .i .s .S 50 51SRCS = ../win/syslinux.c ../win/ntfssect.c 52OBJS = $(patsubst %.c,%.obj,$(notdir $(SRCS))) 53LIBSRC = ../libinstaller/fs.c \ 54 ../libinstaller/syslxmod.c \ 55 ../libinstaller/syslxopt.c \ 56 ../libinstaller/setadv.c \ 57 ../libinstaller/getopt/getopt_long.c \ 58 ../libinstaller/bootsect_bin.c \ 59 ../libinstaller/ldlinux_bin.c \ 60 ../libinstaller/ldlinuxc32_bin.c \ 61 ../libinstaller/mbr_bin.c \ 62 $(wildcard $(SRC)/../libfat/*.c) 63LIBOBJS = $(patsubst %.c,%.obj,$(notdir $(LIBSRC))) 64 65LIB = syslinux.lib 66 67VPATH = $(SRC):$(SRC)/../win:$(SRC)/../libfat:$(SRC)/../libinstaller:$(SRC)/../libinstaller/getopt:$(OBJ)/../libinstaller 68 69TARGETS = syslinux.exe 70 71ifeq ($(WINCC_IS_GOOD),0) 72all: $(TARGETS) 73else 74all: 75 rm -f $(TARGETS) 76endif 77 78tidy dist: 79 -rm -f *.o *.obj *.lib *.i *.s *.a .*.d *.tmp *_bin.c hello.exe 80 81clean: tidy 82 83spotless: clean 84 -rm -f *~ $(TARGETS) 85 86installer: 87 88$(LIB): $(LIBOBJS) 89 rm -f $@ 90 $(WINAR) cq $@ $^ 91 $(WINRANLIB) $@ 92 93syslinux.exe: $(OBJS) $(LIB) 94 $(WINCC) $(WINLDFLAGS) -o $@ $^ 95 96 97%.obj: %.c 98 $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -c -o $@ $< 99%.i: %.c 100 $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -E -o $@ $< 101%.s: %.c 102 $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -S -o $@ $< 103 104-include .*.d 105