Make.rules.in 5.57 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1
# Global rules shared by all makefiles     -*-Makefile-*-
Alexandre Julliard's avatar
Alexandre Julliard committed
2
#
3
# Each individual makefile may define the following variables:
4 5 6 7
# C_SRCS       : C sources for the module
# RC_SRCS      : resource source files
# EXTRA_SRCS   : extra source files for make depend
# EXTRA_OBJS   : extra object files
8 9
# IMPORTS      : dlls to import
# DELAYIMPORTS : dlls to import in delayed mode
10
# EXTRASUBDIRS : subdirectories that do not contain a Makefile
11
# MODCFLAGS    : extra CFLAGS for this module
Alexandre Julliard's avatar
Alexandre Julliard committed
12

Alexandre Julliard's avatar
Alexandre Julliard committed
13 14
# First some useful definitions

15
LDSHARED     = @LDSHARED@
16
INCLUDES     = -I$(srcdir) -I. -I$(top_srcdir)/include -I$(top_builddir)/include $(EXTRAINCL)
17
ALLCFLAGS    = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
18
ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
19
IDLFLAGS     = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
20
RCFLAGS      = --nostdinc --po-dir=$(top_srcdir)/po $(TARGETFLAGS) $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
21

22 23 24 25
IDL_GEN_C_SRCS  = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
                  $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
                  $(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)
26

27
CLEAN_FILES   = *.o *.a *.so *.ln *.res *.fake *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
28
CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
29
                $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) \
30
                $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot) $(XTEMPLATE_SRCS:.x=.h)
Alexandre Julliard's avatar
Alexandre Julliard committed
31

32
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) \
33
       $(IDL_R_SRCS:.idl=_r.res) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
Alexandre Julliard's avatar
Alexandre Julliard committed
34

35
CROSSOBJS = $(OBJS:.o=.cross.o)
36
LINTS  = $(C_SRCS:.c=.ln)
37

38
filter: dummy
39
	@$(top_srcdir)/tools/winapi/make_filter --make $(MAKE) all
40 41 42

.PHONY: all filter

Alexandre Julliard's avatar
Alexandre Julliard committed
43 44
# Implicit rules

45
.SUFFIXES: .mc .rc .res .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .man.in .man _c.c _i.c _p.c _s.c _r.res .cross.o @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
Alexandre Julliard's avatar
Alexandre Julliard committed
46 47

.c.o:
48
	$(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliard's avatar
Alexandre Julliard committed
49

50
.c.cross.o:
51
	$(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
52

53
.y.tab.c:
54
	$(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
55 56

.y.tab.h:
57
	$(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
58 59

.l.yy.c:
60
	$(FLEX) $(LEXFLAGS) -o$@ $<
61

62
.mc.res:
63
	$(LDPATH) $(WMC) -U -O res -P $(top_srcdir)/po -o $@ $<
64

Alexandre Julliard's avatar
Alexandre Julliard committed
65
.rc.res:
66
	$(LDPATH) $(WRC) $(RCFLAGS) -o $@ $<
Alexandre Julliard's avatar
Alexandre Julliard committed
67

68
.idl.h:
69
	$(WIDL) $(IDLFLAGS) -h -o $@ $<
70

71
.idl_c.c:
72
	$(WIDL) $(IDLFLAGS) -c -o $@ $<
73 74

.idl_i.c:
75
	$(WIDL) $(IDLFLAGS) -u -o $@ $<
76 77

.idl_p.c:
78
	$(WIDL) $(IDLFLAGS) -p -o $@ $<
79

80 81 82
.idl_r.res:
	$(WIDL) $(IDLFLAGS) -r -o $@ $<

83
.idl_s.c:
84
	$(WIDL) $(IDLFLAGS) -s -o $@ $<
85

Huw Davies's avatar
Huw Davies committed
86
.idl.tlb:
87
	$(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
Huw Davies's avatar
Huw Davies committed
88

89 90 91
.c.ln:
	$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )

92
.c.ok:
93
	$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
94

95
.sfd.ttf:
96
	$(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
97

98
.man.in.man:
99
	LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
100

101
.svg.ico:
102
	CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
103

104
.svg.bmp:
105
	CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
106

107 108 109
# Rules for IDL files

dlldata.c: $(WIDL) Makefile.in
110
	$(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
111

Alexandre Julliard's avatar
Alexandre Julliard committed
112 113
# Rule for linting

114 115 116 117 118 119 120 121 122 123
$(MODULE).ln : $(LINTS)
	if test "$(LINTS)" ; \
	then \
		$(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
	        $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
	else \
		$(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
	fi

lint:: $(MODULE).ln
Alexandre Julliard's avatar
Alexandre Julliard committed
124

125 126
# Rules for Windows API checking

127
winapi_check:: dummy
128 129
	$(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .

130 131
.PHONY: winapi_check

132 133
# Rules for dependencies

134
DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
135
              $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
136
              $(IDL_GEN_C_SRCS) $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
137
              $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
138

139
depend: dummy
140
	$(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
141

142
.PHONY: depend
143

144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
# Rules for man pages

MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)

all: $(MANPAGES)

install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
	$(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)

uninstall-man-pages::
	$(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)

install:: @WOW64_DISABLE@ $(MANPAGE:%=install-man-pages)
uninstall:: @WOW64_DISABLE@ $(MANPAGE:%=uninstall-man-pages)

159 160 161 162 163
# Rules for cleaning

$(EXTRASUBDIRS:%=%/__clean__): dummy
	-cd `dirname $@` && $(RM) $(CLEAN_FILES)

164
clean:: $(EXTRASUBDIRS:%=%/__clean__)
165
	$(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
166

167
.PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
168

169 170
# Rules for installing

171 172 173
$(INSTALLDIRS):
	$(MKINSTALLDIRS) $@

174
install install-lib install-dev uninstall::
175

176
.PHONY: install install-lib install-dev uninstall
177

178
# Rules for resources
Alexandre Julliard's avatar
Alexandre Julliard committed
179

180
all: @MAINTAINER_MODE@ $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot)
181

182
rsrc.pot: $(WRC)
183
	$(LDPATH) $(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
184

185 186 187 188
msg.pot: $(WMC)
	$(LDPATH) $(WMC) -O pot -o $@ $(MC_SRCS)

$(MC_SRCS:.mc=.res): $(WMC) $(ALL_PO_FILES)
189
$(RC_SRCS:.rc=.res): $(WRC)
190
$(PO_SRCS:.rc=.res): $(ALL_PO_FILES)
191

192 193 194 195
# Misc. rules

$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)

Alexandre Julliard's avatar
Alexandre Julliard committed
196
dummy:
Alexandre Julliard's avatar
Alexandre Julliard committed
197

198
.PHONY: dummy
199

Alexandre Julliard's avatar
Alexandre Julliard committed
200
# End of global rules