aboutsummaryrefslogtreecommitdiffstats
path: root/win32/Makefile
blob: bd957fa4911d085d343eb26c23bb72fe506c231f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
## $Id$
## -----------------------------------------------------------------------
##   
##   Copyright 1998-2004 H. Peter Anvin - All Rights Reserved
##
##   This program is free software; you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
##   Boston MA 02111-1307, USA; either version 2 of the License, or
##   (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------

#
# Makefile for SYSLINUX Win32
#
# This is separated out mostly so we can have a different set of Makefile
# variables.
#

OSTYPE   = $(shell uname -msr)
ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN)
CC       = gcc
AR	 = ar
RANLIB   = ranlib
CFLAGS   = -mno-cygwin -W -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
PIC	 =
LDFLAGS  = -mno-cygwin -O2 -s
else
ifeq ($(findstring MINGW32,$(OSTYPE)),MINGW32)
CC       = gcc
AR	 = ar
RANLIB   = ranlib
else
CC       = mingw-gcc
AR	 = mingw-ar
RANLIB   = mingw-ranlib
endif
CC_IS_GOOD := $(shell $(CC) $(CFLAGS) $(LDFLAGS) -o hello.exe hello.c >/dev/null 2>&1 ; echo $$?)

CFLAGS   = -W -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
PIC      =
LDFLAGS  = -O2 -s
endif
INCLUDE += -I..

PERL     = perl

VERSION  = $(shell cat ../version)

.c.o:
	$(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $<

.c.i:
	$(CC) $(INCLUDE) $(CFLAGS) -E -o $@ $<

ifeq ($(CC_IS_GOOD),0)
all: ../syslinux.exe
else
all:	# We don't have a working win32 compiler
	rm -f ../syslinux.exe
endif

libsyslinux.a: bootsect_bin.o ldlinux_bin.o syslxmod.o
	rm -f $@
	$(AR) cq $@ $^
	$(RANLIB) $@

../syslinux.exe: syslinux-mingw.o libsyslinux.a
	$(CC) $(LDFLAGS) -o $@ $^

syslxmod.o: ../syslxmod.c ../patch.offset
	$(CC) $(INCLUDE) $(CFLAGS) $(PIC) -DPATCH_OFFSET=`cat ../patch.offset` \
		-c -o $@ $<

bootsect_bin.o: ../bootsect_bin.c
	$(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $<

ldlinux_bin.o: ../ldlinux_bin.c
	$(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $<

tidy:
	rm -f *.o *.a hello.exe

clean: tidy

spotless: clean
	rm -f ../syslinux.exe *~