1 |
############################################################################## |
2 |
# |
3 |
# Makefile for XviD VFW driver |
4 |
# |
5 |
# Author : ??? <cutka at szm.sk> |
6 |
# Modified by : Edouard Gomez <ed.gomez at free.fr> |
7 |
# Peter Ross <pross@xvid.org> |
8 |
# |
9 |
# Requires GNU Make because of shell expansion performed at a bad time with |
10 |
# other make programs (even using := variable assignments) |
11 |
# |
12 |
# $Id: Makefile,v 1.1.2.4 2004-03-31 19:10:24 edgomez Exp $ |
13 |
############################################################################## |
14 |
|
15 |
include sources.inc |
16 |
|
17 |
MAKEFILE_PWD:=$(shell pwd) |
18 |
LOCAL_XVID_SRCTREE:=$(MAKEFILE_PWD)/../../src |
19 |
LOCAL_XVID_BUILDTREE:=$(MAKEFILE_PWD)/../../build/generic/=build |
20 |
|
21 |
RM = rm -rf |
22 |
WINDRES=windres |
23 |
|
24 |
# Constants which should not be modified |
25 |
# The `mingw-runtime` package is required when building with -mno-cygwin |
26 |
CFLAGS += -I$(SRC_DIR)/w32api -I$(LOCAL_XVID_SRCTREE) |
27 |
CFLAGS += -D_WIN32_IE=0x0500 |
28 |
CFLAGS += -mno-cygwin |
29 |
|
30 |
############################################################################## |
31 |
# Optional Compiler options |
32 |
############################################################################## |
33 |
|
34 |
CFLAGS += -Wall |
35 |
CFLAGS += -O2 |
36 |
CFLAGS += -fstrength-reduce |
37 |
CFLAGS += -finline-functions |
38 |
CFLAGS += -fgcse |
39 |
CFLAGS += -freduce-all-givs |
40 |
CFLAGS += -ffast-math |
41 |
|
42 |
############################################################################## |
43 |
# Compiler flags for linking stage |
44 |
############################################################################## |
45 |
|
46 |
# LDFLAGS += |
47 |
|
48 |
############################################################################## |
49 |
# Rules |
50 |
############################################################################## |
51 |
|
52 |
OBJECTS = $(SRC_C:.c=.obj) |
53 |
OBJECTS+= $(SRC_RES:.rc=.obj) |
54 |
|
55 |
.SUFFIXES: .obj .rc .c |
56 |
|
57 |
BUILD_DIR = =build |
58 |
VPATH = $(SRC_DIR):$(BUILD_DIR) |
59 |
|
60 |
all: $(LIBSO) |
61 |
|
62 |
$(BUILD_DIR): |
63 |
@echo " D: $(BUILD_DIR)" |
64 |
@mkdir -p $(BUILD_DIR) |
65 |
|
66 |
.rc.obj: |
67 |
@echo " W: $(@D)/$(<F)" |
68 |
@mkdir -p $(BUILD_DIR)/$(@D) |
69 |
@$(WINDRES) \ |
70 |
--include-dir=$(SRC_DIR) \ |
71 |
--input-format=rc \ |
72 |
--output-format=coff \ |
73 |
-o $(BUILD_DIR)/$@ $< |
74 |
|
75 |
.c.obj: |
76 |
@echo " C: $(@D)/$(<F)" |
77 |
@mkdir -p $(BUILD_DIR)/$(@D) |
78 |
@$(CC) $(CFLAGS) -c -o $(BUILD_DIR)/$@ $< |
79 |
|
80 |
$(LIBSO): $(BUILD_DIR) $(OBJECTS) |
81 |
@echo " L: $(@F)" |
82 |
@cp $(SRC_DIR)/driverproc.def $(BUILD_DIR)/driverproc.def |
83 |
@cd $(BUILD_DIR) && \ |
84 |
$(CC) $(LDFLAGS) \ |
85 |
-mno-cygwin -shared -Wl,-dll,--out-implib,$@.a,--enable-stdcall-fixup \ |
86 |
-o $@ \ |
87 |
$(OBJECTS) driverproc.def \ |
88 |
-lgdi32 -lwinmm -lcomdlg32 -lcomctl32 |
89 |
|
90 |
clean: |
91 |
@echo " Cl: Object files and target lib" |
92 |
@$(RM) $(BUILD_DIR) |
93 |
|
94 |
install: |
95 |
@echo " I: xvid.dll" |
96 |
@cp $(BUILD_DIR)/$(LIBSO) $(LIBSO) |
97 |
@rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 ./xvid.inf |
98 |
@rm $(LIBSO) |
99 |
|
100 |
uninstall: |
101 |
@rundll32.exe setupapi,InstallHinfSection Remove_XviD 132 ./xvid.inf |