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
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
LC_REQ=@LC_REQ@ 
 
LINKAGE_CPPFLAGS= 
DYNAMIC_LINKAGE_CFLAGS=@CCSHARED@ 
DYNAMIC_LINKAGE_CXXFLAGS=@CCSHARED@ 
STATIC_LINKAGE_CFLAGS= 
LINKAGE_CFLAGS=$(DYNAMIC_LINKAGE_CFLAGS) 
LINKAGE_CXXFLAGS=$(DYNAMIC_LINKAGE_CXXFLAGS) 
 
MODULE_PROGRAM=.$(MODULE_WRAPPER_PREFIX)$(MODNAME) 
MODULE_TARGET=$(TMP_MODULE_BASE)/$(MODDIR)$(MODULE_WRAPPER_PREFIX)$(MODNAME).so 
 
# The reason for this is that we can't use targets directly to specify 
# the build type; many module makefiles depend on being able to 
# override the default target. 
all: 
        @case "x$$MODULE_BUILD_TYPE" in \ 
          xstatic) $(MAKE) $(MAKE_FLAGS) static;; \ 
          xdynamic) $(MAKE) $(MAKE_FLAGS) dynamic;; \ 
          x) $(MAKE) $(MAKE_FLAGS) static dynamic;; \ 
          *) \ 
            echo "Invalid MODULE_BUILD_TYPE: $$MODULE_BUILD_TYPE" >&2; \ 
            exit 1;; \ 
        esac 
 
@common_module_makefile@ 
 
build_type: Makefile 
        @echo dynamic > build_type 
 
static: Makefile $(DUMMY) module-preamble 
        @: 
 
# Depend on $(DUMMY) here too for the sake of post modules, where the 
# static target never gets called. 
dynamic: $(DUMMY) module-main 
        @: 
 
linker_options: Makefile 
        @if test "x$(LINKER_OPTIONS)" != x ; then \ 
          echo "echo $(LINKER_OPTIONS) > linker_options" ; \ 
        else : ; fi ; \ 
        echo "$(LINKER_OPTIONS)" >linker_options 
 
modlist_segment: Makefile 
        @echo "" >modlist_segment 
 
# Can't depend on $(SRCDIR)/$(CONFIG_HEADERS).in since 
# $(CONFIG_HEADERS) isn't always used. 
Makefile: $(MODULE_BASE)/dynamic_module_makefile $(SRCDIR)/Makefile.in $(SRCDIR)/dependencies make_variables config.status 
        CONFIG_FILES=Makefile CONFIG_HEADERS="$(CONFIG_HEADERS)" ./config.status 
        touch remake 
        @echo "Run make again" >&2 
        @exit 1 
 
$(MODULE_TARGET): module.so 
        @if test "x$(OBJS)" = "x" ; then \ 
          exit 0; \ 
        fi; \ 
        if test "x$(PIKE_EXTERNAL_MODULE)" = "x" ; then \ 
          $(TMP_BINDIR)/install_module module.so $(MODULE_TARGET) && \ 
          if [ -f $(MODNAME).pdb ]; then \ 
            cp $(MODNAME).pdb `echo "$(MODULE_TARGET)" | sed -e 's,[^/]*$$,,'`; \ 
          else :; fi; \ 
        fi 
 
module.so: $(MODULE_ARCHIVES) $(OBJS) $(LDSHARED_MODULE_REQS) 
        @if test "x$(OBJS)" = "x" ; then \ 
          exit 0; \ 
        fi; \ 
        echo "Linking $(MODNAME)" ;\ 
        modname="$(MODNAME)"; \ 
        if $(TMP_BINDIR)/smartlink $(MOD_LDSHARED) $(LDFLAGS) -o module.@SO@ \ 
          $(OBJS) $(MODULE_ARCHIVES) $(MODULE_LDFLAGS) \ 
          $(LIBGCC) $(LC_REQ) $(LIBGCC) ; then \ 
          if test @SO@ != so ; then mv module.@SO@ module.so ; else :; fi ;\ 
        else \ 
          echo "Linking failed:" >&2; \ 
          echo $(TMP_BINDIR)/smartlink $(MOD_LDSHARED) $(LDFLAGS) -o module.@SO@ $(OBJS) $(MODULE_ARCHIVES) $(MODULE_LDFLAGS) $(LIBGCC) $(LC_REQ) $(LIBGCC) >&2 ;\ 
          exit 1; \ 
        fi 
        $(MT_FIX_MODULE_SO) 
 
$(OBJS): propagated_variables 
 
# 
# install a standard module with optional c component in the system module path 
# 
install: $(MODULE_INSTALL) 
        @if test "x$(OBJS)" != "x" ; then \ 
          $(TMP_BINDIR)/install_module module.so $(SYSTEM_MODULE_PATH)/$(MODDIR)$(MODULE_WRAPPER_PREFIX)$(MODNAME).so && \ 
          if [ -f $(MODNAME).pdb ]; then \ 
            cp $(MODNAME).pdb $(SYSTEM_MODULE_PATH)/$(MODDIR)$(MODULE_WRAPPER_PREFIX); \ 
          else :; fi; \ 
        fi; \ 
        if test "x$(MODULE_PMOD_IN)" != "x"; then \ 
          $(TMP_BINDIR)/install_module module.pmod $(SYSTEM_MODULE_PATH)/$(MODDIR)$(MODNAME).pmod ;\ 
        fi; 
 
# 
# install the module in LOCAL_MODULE_PATH, creating it if it doesn't already exist. 
# 
local_install: $(MODULE_INSTALL) 
        if test ! -d "$(LOCAL_MODULE_PATH)" ; then \ 
          mkdir -p $(LOCAL_MODULE_PATH) ; \ 
        fi; if test "x$(OBJS)" != "x" ; then \ 
          $(TMP_BINDIR)/install_module module.so $(LOCAL_MODULE_PATH)/$(MODDIR)$(MODULE_WRAPPER_PREFIX)$(MODNAME).so && \ 
          if [ -f $(MODNAME).pdb ]; then \ 
            cp $(MODNAME).pdb $(SYSTEM_MODULE_PATH)/$(MODDIR)$(MODULE_WRAPPER_PREFIX); \ 
          else :; fi; \ 
        fi; \ 
        if test "x$(MODULE_PMOD_IN)" != "x"; then \ 
          $(TMP_BINDIR)/install_module module.pmod $(LOCAL_MODULE_PATH)/$(MODDIR)$(MODNAME).pmod ;\ 
        fi 
 
dump_module: install 
        -rm -f dumpmodule.log 
        args=$${args:-"--log-file --update-only=dumpversion --report-failed"}; \ 
        $(FINAL_PIKE) -x dump $$args \ 
        --recursive "$(SYSTEM_MODULE_PATH)/$(MODDIR)$(MODNAME).pmod" 
 
dump_local_module: install 
        -rm -f dumpmodule.log 
        args=$${args:-"--log-file --update-only=dumpversion --report-failed"}; \ 
        $(FINAL_PIKE) -x dump $$args \ 
        --recursive "$(LOCAL_MODULE_PATH)/$(MODDIR)$(MODNAME).pmod"