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
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
# 
# $Id: static_module_makefile.in,v 1.61 2001/02/01 10:27:30 hubbe Exp $ 
# 
 
 
CC=@CC@ 
CPP=@CPP@ 
AR=@AR@ 
PIKE_SRC_DIR=$(SRCDIR)/../.. 
BUILD_BASE=../.. 
MODULE_BASE=.. 
 
REAL_LDFLAGS=@LDFLAGS@ 
REAL_CFLAGS=@CFLAGS@ 
REAL_CPPFLAGS=@CPPFLAGS@ 
 
PREFLAGS=-I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../.. -I. -Dpike_module_init=pike_module_$(MODNAME)_init -Dpike_module_exit=pike_module_$(MODNAME)_exit $(MODULE_CPPFLAGS) $(DEFINES)  
CFLAGS=$(PREFLAGS) $(OTHERFLAGS) $(MODULE_CFLAGS) 
NOOPT_CFLAGS=$(PREFLAGS) $(NOOPTFLAGS) @CCSHARED@ $(MODULE_CFLAGS) 
 
MAKE_FLAGS = "prefix=$(prefix)" "exec_prefix=$(exec_prefix)" "CC=$(CC)" "OTHERFLAGS=$(OTHERFLAGS)" "TMP_BINDIR=$(TMP_BINDIR)" "DEFINES=$(DEFINES)" "TMP_LIBDIR=$(TMP_LIBDIR)" "RUNPIKE=$(RUNPIKE)" "INSTALL=$(INSTALL)" "AR=$(AR)" "NOOPTFLAGS=$(NOOPTFLAGS)" $(MODULE_MAKE_FLAGS) 
 
MODNAME=`pwd|sed -e 's@.*/@@g'` 
 
all: dummy 
 
force: 
        @:; 
 
$(MODULE_ARCHIVES) ThisIsAPhonyTargetBlaBlaBla: force 
        @a=`echo $@ | sed -e 's@/[^/]*$$@@'` ; \ 
        echo Making $(MODNAME)/$$a ; \ 
        ( rm $$a/remake >/dev/null 2>&1 ||: ; \ 
          cd $$a && ( $(MAKE) $(MAKE_FLAGS) || \ 
                      ( test -f remake ; $(MAKE) $(MAKE_FLAGS) ) ) \ 
        ) || exit $$? 
 
dummy:  linker_options modlist_headers modlist_segment module.pmod module.a 
        @tmp="$(INSTALL_NAME)" ;\ 
        if test x$$tmp = x ; then tmp="$(MODNAME)"; else :; fi ;\ 
        $(TMP_BINDIR)/install_module module.pmod $(TMP_LIBDIR)/modules/$$tmp.pmod 
 
.SUFFIXES: .c .o 
 
# GCC dumps core on some files @ OSF1 
# This kluge should work around that... 
# FIXME: Make this a configure option 
.c.o: 
        @echo "Compiling $<" ;\ 
        if $(CC) $(CFLAGS) -c $< -o $@ ; then : ;\ 
        else \ 
          echo "WARNING: Compiler failure! Trying without optimization!" >&2;\ 
          echo "echo $(CC) $(NOOPT_CFLAGS) -c $< -o $@" >&2;\ 
          NO_ULIMIT=yes $(CC) $(NOOPT_CFLAGS) -c $< -o $@ ;\ 
        fi 
 
linker_options: Makefile $(MODULE_ARCHIVES) 
        echo >linker_options `pwd`/module.a $(MODULE_LDFLAGS) 
        @for a in '' $(MODULE_ARCHIVES) ; do \ 
          if test "x$$a" = "x"; then :; else \ 
            case "$$a" in \ 
              /*) \ 
                echo $$a \ 
              ;; \ 
              *) \ 
                echo `pwd`/$$a \ 
              ;; \ 
            esac >>linker_options; \ 
          fi; \ 
        done 
 
modlist_headers: Makefile 
        @echo >modlist_headers "void pike_module_$(MODNAME)_init(void), pike_module_$(MODNAME)_exit(void);" 
 
modlist_segment: Makefile 
        @echo >modlist_segment " ,{ \"$(MODNAME)\", pike_module_$(MODNAME)_init, pike_module_$(MODNAME)_exit } " 
 
Makefile: $(MODULE_BASE)/static_module_makefile $(SRCDIR)/Makefile.in $(SRCDIR)/dependencies $(SRCDIR)/$(CONFIG_HEADERS).in config.status 
        CFLAGS="$(REAL_CFLAGS)" LDFLAGS="$(REAL_LDFLAGS)" CPPFLAGS="$(REAL_CPPFLAGS)" CONFIG_FILES=Makefile CONFIG_HEADERS="$(CONFIG_HEADERS)" ./config.status 
        touch remake 
        @echo "Run make again" >&2 
        @exit 1 
 
$(SRCDIR)/configure: $(SRCDIR)/configure.in $(PIKE_SRC_DIR)/aclocal.m4 
        cd $(SRCDIR) && autoconf --localdir=$(PIKE_SRC_DIR) 
        if [ -f $(SRCDIR)/acconfig.h ]; then \ 
          cd $(SRCDIR) && autoheader; \ 
        else :; fi 
 
config.status: $(SRCDIR)/configure 
        CFLAGS="$(REAL_CFLAGS)" LDFLAGS="$(REAL_LDFLAGS)" CPPFLAGS="$(REAL_CPPFLAGS)" CONFIG_FILES=Makefile CONFIG_HEADERS="$(CONFIG_HEADERS)" ./config.status --recheck 
 
module.pmod: Makefile 
        @echo "Making module.pmod" ; if [ -f $(SRCDIR)/module.pmod.in ]; then \ 
           sed -e "s/@module@/__builtin_dirnode.$(MODNAME)/" <$(SRCDIR)/module.pmod.in >module.pmod ;\ 
        else \ 
          if [ -f ./module.pmod.in ]; then \ 
           sed -e "s/@module@/__builtin_dirnode.$(MODNAME)/" <./module.pmod.in >module.pmod ;\ 
          else \ 
            echo >>module.pmod "#pike __REAL_VERSION__" ;\ 
            echo >>module.pmod "#if constant(_static_modules.$(MODNAME));" ;\ 
            echo >>module.pmod "inherit _static_modules.$(MODNAME);" ;\ 
            echo >>module.pmod "#endif" ;\ 
          fi ;\ 
        fi 
 
module.a: $(OBJS) 
        -rm -f module.a 
        $(AR) cq module.a $(OBJS) 
        -@RANLIB@ module.a 
        if test -f linker_options ; then touch linker_options ; else :; fi 
 
$(OBJS) : $(MODULE_BASE)/dynamic_module_makefile 
 
clean: 
        -rm -f *.o *.obj *.a *.so module.so module.pmod linker_options modlist_headers modlist_segment module_testsuite $(MODULE_CLEAN_EXTRA) 
        for a in '' $(MODULE_SUBDIRS) ; do if test "x$$a" = "x"; then :; else echo cleaning $$a ; ( cd $$a ; $(MAKE) $(MAKE_FLAGS) clean ) ; fi ; done 
 
depend: 
        gcc -MM $(PREFLAGS) $(SRCDIR)/*.c | $(TMP_BINDIR)/fixdepends.sh $(SRCDIR) 
        CONFIG_FILES=Makefile CONFIG_HEADERS="" ./config.status 
        @for a in '' $(MODULE_SUBDIRS) ; do \ 
          if test "x$$a" = "x"; then :; else \ 
            echo making depend in $$a; \ 
            ( cd $$a && { \ 
              rm -f remake; \ 
              $(MAKE) $(MAKE_FLAGS) MODNAME=$$a depend || \ 
                if test -f remake; then $(MAKE) $(MAKE_FLAGS) MODNAME=$$a depend; \ 
                else exit $$?; fi; \ 
            }); \ 
          fi; \ 
        done 
 
#verify / debug 
module_testsuite: $(SRCDIR)/testsuite.in $(REAL_TESTSUITE) 
        if test "x$(REAL_TESTSUITE)" != x ; then cp $(SRCDIR)/$(REAL_TESTSUITE) module_testsuite; else $(TMP_BINDIR)/mktestsuite $(SRCDIR)/testsuite.in >module_testsuite -DSRCDIR=$(SRCDIR); fi 
 
extra_tests: $(MODULE_TESTS) 
 
verify: module_testsuite $(MODULE_TESTS) 
        $(RUNPIKE) $(TMP_BINDIR)/test_pike.pike module_testsuite 
 
verbose_verify: module_testsuite $(MODULE_TESTS) 
        $(RUNPIKE) $(TMP_BINDIR)/test_pike.pike module_testsuite --verbose 
 
gdb_verify: module_testsuite 
        @echo >.gdbinit handle SIGUSR1 nostop noprint pass 
        @echo >>.gdbinit run -DNOT_INSTALLED -m ../../lib/master.pike $(PIKEOPTS) $(SRCDIR)/../../../bin/test_pike.pike module_testsuite -v -v -f 
        gdb ../../pike 
        @rm .gdbinit 
 
install: $(MODULE_INSTALL)