]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Template makefile for building wxWindows companion libraries. | |
3 | # | |
4 | # Author: Ron Lee <ron@debian.org> | |
5 | # Created: 19/3/2000 | |
6 | # $Id$ | |
7 | # | |
8 | # To use, set the following vars before including it: | |
9 | # | |
10 | # top_srcdir | |
11 | # top_builddir | |
12 | # libsrc_dir | |
13 | # | |
14 | # TARGET_LIBNAME | |
15 | # LIBVERSION_CURRENT | |
16 | # LIBVERSION_REVISION | |
17 | # LIBVERSION_AGE | |
18 | # HEADER_PATH | |
19 | # HEADER_SUBDIR | |
20 | # | |
21 | # HEADERS | |
22 | # OBJECTS | |
23 | # | |
24 | # either a shared or static lib will be built according to the | |
25 | # option given to configure. | |
26 | # | |
27 | ||
28 | prefix = @prefix@ | |
29 | exec_prefix = @exec_prefix@ | |
30 | includedir = @includedir@ | |
31 | libdir = @libdir@ | |
32 | ||
33 | INSTALL = @INSTALL@ | |
34 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
35 | INSTALL_DATA = @INSTALL_DATA@ | |
36 | ||
37 | TARGETLIB_STATIC = $(TARGET_LIBNAME).a | |
38 | TARGETLIB_SHARED = $(TARGET_LIBNAME).so.$(LIBVERSION_CURRENT).$(LIBVERSION_REVISION).$(LIBVERSION_AGE) | |
39 | TARGETLIB_LINK1 = $(TARGET_LIBNAME).so.$(LIBVERSION_CURRENT) | |
40 | TARGETLIB_LINK2 = $(TARGET_LIBNAME).so | |
41 | ||
42 | TARGETLIB_SONAME = @WX_TARGET_LIBRARY_SONAME@ | |
43 | ||
44 | %.o : %.c | |
45 | $(CC) -c $(CFLAGS) $(PICFLAGS) -o $@ $< | |
46 | ||
47 | %.o : %.cpp | |
48 | $(CXX) -c $(CXXFLAGS) $(PICFLAGS) -o $@ $< | |
49 | ||
50 | %.o : %.cxx | |
51 | $(CXX) -c $(CXXFLAGS) $(PICFLAGS) -o $@ $< | |
52 | ||
53 | # the comment at the end of the next line is needed because otherwise autoconf | |
54 | # would remove this line completely - it contains a built-in hack to remove | |
55 | # any VPATH assignment not containing ':' | |
56 | VPATH = @PATH_IFS@$(top_srcdir)/$(libsrc_dir) # ':' for autoconf | |
57 | ||
58 | include $(top_builddir)/src/make.env | |
59 | ||
60 | all: libtype_@WX_TARGET_LIBRARY_TYPE@ | |
61 | ||
62 | libtype_so: $(top_builddir)/lib/$(TARGETLIB_SHARED) | |
63 | ||
64 | libtype_a: $(top_builddir)/lib/$(TARGETLIB_STATIC) | |
65 | ||
66 | $(top_builddir)/lib/$(TARGETLIB_SHARED): $(OBJECTS) $(top_builddir)/lib/@WX_LIBRARY_NAME_SHARED@ | |
67 | @$(INSTALL) -d $(top_builddir)/lib | |
68 | $(SHARED_LD) $@ $(TARGETLIB_SONAME) $(OBJECTS) -L$(top_builddir)/lib @WXCONFIG_LIBS@ $(EXTRALIBS) $(OPENGLLIBS) | |
69 | cd $(top_builddir)/lib \ | |
70 | && $(RM) $(TARGETLIB_LINK1) $(TARGETLIB_LINK2) \ | |
71 | && $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK1) \ | |
72 | && $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK2) | |
73 | ||
74 | $(top_builddir)/lib/$(TARGETLIB_STATIC): $(OBJECTS) | |
75 | @$(INSTALL) -d $(top_builddir)/lib | |
76 | @$(RM) $@ | |
77 | $(AR) $(AROPTIONS) $@ $(OBJECTS) | |
78 | $(RANLIB) $@ | |
79 | ||
80 | install: install_@WX_TARGET_LIBRARY_TYPE@ install_headers | |
81 | ||
82 | install_so: | |
83 | $(INSTALL_PROGRAM) $(top_builddir)/lib/$(TARGETLIB_SHARED) $(libdir)/$(TARGETLIB_SHARED) | |
84 | @$(RM) $(libdir)/$(TARGETLIB_LINK1) $(libdir)/$(TARGETLIB_LINK2) | |
85 | cd $(libdir) \ | |
86 | && $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK1) \ | |
87 | && $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK2) | |
88 | ||
89 | install_a: | |
90 | $(INSTALL_PROGRAM) $(top_builddir)/lib/$(TARGETLIB_STATIC) $(libdir)/$(TARGETLIB_STATIC) | |
91 | ||
92 | install_headers: | |
93 | $(INSTALL) -d $(includedir)/wx/$(HEADER_SUBDIR) | |
94 | @for h in $(HEADERS); do \ | |
95 | $(INSTALL_DATA) $(HEADER_PATH)/$(HEADER_SUBDIR)/$$h $(includedir)/wx/$(HEADER_SUBDIR)/$$h; \ | |
96 | echo "installing $(includedir)/wx/$(HEADER_SUBDIR)/$$h"; \ | |
97 | done | |
98 | ||
99 | uninstall: | |
100 | $(RM) $(libdir)/$(TARGETLIB_STATIC) | |
101 | $(RM) $(libdir)/$(TARGETLIB_SHARED) | |
102 | $(RM) $(libdir)/$(TARGETLIB_LINK1) | |
103 | $(RM) $(libdir)/$(TARGETLIB_LINK2) | |
104 | @echo "removing headers" | |
105 | @for h in $(HEADERS); do \ | |
106 | $(RM) $(includedir)/wx/$(HEADER_SUBDIR)/$$h; \ | |
107 | done | |
108 | @if test -d $(includedir)/wx/$(HEADER_SUBDIR); then \ | |
109 | rmdir $(includedir)/wx/$(HEADER_SUBDIR); \ | |
110 | fi | |
111 | @-rmdir $(includedir)/wx | |
112 | ||
113 | clean: | |
114 | $(RM) $(OBJECTS) $(top_builddir)/lib/$(TARGETLIB_SHARED) \ | |
115 | $(top_builddir)/lib/$(TARGETLIB_LINK1) \ | |
116 | $(top_builddir)/lib/$(TARGETLIB_LINK2) \ | |
117 | $(top_builddir)/lib/$(TARGETLIB_STATIC) core | |
118 | ||
119 | .PHONY: all libtype_so libtype_a install install_so install_a install_headers uninstall clean | |
120 |