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 Win32 NTFS file cluster test |
---|
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 | ## Compiling on Cygwin |
---|
24 | WINPREFIX := |
---|
25 | WINCFLAGS := -mno-cygwin $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 |
---|
26 | WINLDFLAGS := -mno-cygwin -Os -s |
---|
27 | else |
---|
28 | ## Compiling on some variant of MinGW |
---|
29 | ifeq ($(findstring MINGW32,$(OSTYPE)),MINGW32) |
---|
30 | WINPREFIX := |
---|
31 | else |
---|
32 | WINPREFIX := $(shell ../find-mingw32.sh gcc) |
---|
33 | endif |
---|
34 | WINCFLAGS := $(GCCWARN) -Wno-sign-compare -Os -fomit-frame-pointer \ |
---|
35 | -D_FILE_OFFSET_BITS=64 |
---|
36 | WINLDFLAGS := -Os -s |
---|
37 | endif |
---|
38 | WINCFLAGS += -I. -I../../win |
---|
39 | |
---|
40 | WINCC := $(WINPREFIX)gcc |
---|
41 | WINAR := $(WINPREFIX)ar |
---|
42 | WINRANLIB := $(WINPREFIX)ranlib |
---|
43 | WINDRES := $(WINPREFIX)windres |
---|
44 | |
---|
45 | WINCC_IS_GOOD := $(shell $(WINCC) $(WINCFLAGS) $(WINLDFLAGS) \ |
---|
46 | -o hello.exe ../../win/hello.c >/dev/null 2>&1 ; echo $$?) |
---|
47 | |
---|
48 | .SUFFIXES: .c .obj .lib .exe .i .s .S .rc .res |
---|
49 | |
---|
50 | SRCS = ../../win/ntfstest.c ../../win/ntfssect.c |
---|
51 | RCS = ../../win/ntfstest.rc |
---|
52 | OBJS = $(patsubst %.c,%.obj,$(notdir $(SRCS))) |
---|
53 | RESS = $(patsubst %.rc,%.res,$(notdir $(RCS))) |
---|
54 | |
---|
55 | VPATH = .:../../win |
---|
56 | |
---|
57 | TARGETS = ntfstest.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 | ntfstest.exe: $(OBJS) $(RESS) |
---|
75 | $(WINCC) $(WINLDFLAGS) -o $@ $^ |
---|
76 | |
---|
77 | |
---|
78 | %.obj: %.c |
---|
79 | $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -c -o $@ $< |
---|
80 | %.i: %.c |
---|
81 | $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -E -o $@ $< |
---|
82 | %.s: %.c |
---|
83 | $(WINCC) $(UMAKEDEPS) $(WINCFLAGS) -S -o $@ $< |
---|
84 | %.res: %.rc |
---|
85 | $(WINDRES) -O COFF $< $@ |
---|
86 | |
---|
87 | -include .*.d |
---|