1# -*- make -*- 2MODULES = slsmg-module.so termios-module.so select-module.so fcntl-module.so \ 3 varray-module.so socket-module.so rand-module.so fork-module.so \ 4 csv-module.so base64-module.so chksum-module.so histogram-module.so \ 5 stats-module.so json-module.so \ 6 @PCRE_MODULE@ @PNG_MODULE@ @ICONV_MODULE@ @ONIG_MODULE@ @ZLIB_MODULE@ @SYSCONF_MODULE@ 7SLFILES = slsmg termios select fcntl varray socket rand fork csv \ 8 base64 chksum histogram stats json \ 9 pcre png iconv onig zlib sysconf 10TEST_SCRIPTS = test_slsmg.sl test_termios.sl test_select.sl test_fcntl.sl \ 11 test_varray.sl test_socket.sl test_rand.sl test_fork.sl test_csv.sl \ 12 test_base64.sl test_chksum.sl test_hist.sl test_stats.sl test_json.sl 13# 14CHKSUM_OBJS = chksum-module.o chksum_md5.o chksum_sha1.o 15STATS_OBJS = stats-module.o stats_kendall.o 16# --------------------------------------------------------------------------- 17CC = @CC@ 18CFLAGS = @CFLAGS@ @SLANG_DLL_CFLAGS@ 19LDFLAGS = @LDFLAGS@ 20CC_SHARED_FLAGS = @CC_SHARED_FLAGS@ 21CC_SHARED = $(CC) $(INCS) $(CC_SHARED_FLAGS) $(CFLAGS) 22CONFIG_DIR = @CONFIG_DIR@ 23SRCDIR = $(CONFIG_DIR)/modules 24CONFIG_H = $(SRCDIR)/config.h 25SLINT_H = $(SRCDIR)/slint.h 26OBJDIR = $(ARCH)objs 27OBJDIR_TSTAMP = $(OBJDIR)/tstamp 28# --------------------------------------------------------------------------- 29# Installation location of the slang library 30# --------------------------------------------------------------------------- 31prefix = @prefix@ 32exec_prefix = @exec_prefix@ 33SLANG_SRCINC = -I@SRCDIR@ 34DLL_IMPLIB_NAME = @DLL_IMPLIB_NAME@ 35# On some systems, the module must be linked to the slang library, 36# but not all do. If you have such system, point SLANG_LIB to the 37# slang library, otherwise leave it blank. 38ELFDIR = @ELFDIR@ 39SLANG_LIB = @SLANG_LIB_FOR_MODULES@ 40 41# --------------------------------------------------------------------------- 42# If building the PCRE module, you may need to set these 43# --------------------------------------------------------------------------- 44PCRE_INC = @PCRE_INC@ 45PCRE_LIB = @PCRE_LIB@ -lpcre 46# --------------------------------------------------------------------------- 47# If building the PNG module, you may need to set these 48# --------------------------------------------------------------------------- 49PNG_INC = @PNG_INC@ 50PNG_LIB = @PNG_LIB@ -lpng 51# --------------------------------------------------------------------------- 52# If building the ICONV module, you may need to set these 53# --------------------------------------------------------------------------- 54ICONV_INC = @ICONV_INC@ 55ICONV_LIB = @ICONV_LIB@ 56# --------------------------------------------------------------------------- 57# If building the ONIG module, you may need to set these 58# --------------------------------------------------------------------------- 59ONIG_INC = @ONIG_INC@ 60ONIG_LIB = @ONIG_LIB@ -lonig 61# --------------------------------------------------------------------------- 62# If building the ZLIB module, you may need to set these 63# --------------------------------------------------------------------------- 64ZLIB_INC = @Z_INC@ 65ZLIB_LIB = @Z_LIB@ -lz 66# --------------------------------------------------------------------------- 67# If building the SOCKET module, you may need to set these 68# --------------------------------------------------------------------------- 69SOCKET_LIBS = @X_EXTRA_LIBS@ 70# --------------------------------------------------------------------------- 71# Installation location of the modules 72# --------------------------------------------------------------------------- 73MODULE_INSTALL_DIR = @libdir@/slang/v@slang_major_version@/modules 74INSTALL = @INSTALL@ 75INSTALL_DATA = @INSTALL_DATA@ 76INSTALL_MODULE = @INSTALL_MODULE@ 77MKINSDIR = $(CONFIG_DIR)/autoconf/mkinsdir.sh 78SLSH_DIR = $(prefix)/share/slsh 79CMAPS_DIR = $(SLSH_DIR)/cmaps 80HELP_DIR = $(SLSH_DIR)/help 81# --------------------------------------------------------------------------- 82# DESTDIR is designed to facilitate making packages. Normally it is empty 83# --------------------------------------------------------------------------- 84#DESTDIR = 85DEST_MODULEDIR = $(DESTDIR)$(MODULE_INSTALL_DIR) 86DEST_SLSH_DIR = $(DESTDIR)$(SLSH_DIR) 87DEST_CMAPSDIR = $(DESTDIR)$(CMAPS_DIR) 88DEST_HELPDIR = $(DESTDIR)$(HELP_DIR) 89# --------------------------------------------------------------------------- 90RPATH = @RPATH@ 91 92LIBS = $(LDFLAGS) $(RPATH) $(SLANG_LIB) $(DL_LIB) @M_LIB@ 93INCS = $(SLANG_SRCINC) 94COMPILE_CMD = $(CC_SHARED) $(INCS) 95# --------------------------------------------------------------------------- 96all: $(OBJDIR)/Makefile 97 cd $(OBJDIR) && $(MAKE) $(MODULES) 98$(CONFIG_H): $(CONFIG_DIR)/src/config.h 99 cp $(CONFIG_DIR)/src/config.h $(CONFIG_H) 100$(SLINT_H): $(CONFIG_DIR)/src/_slint.h 101 cp $(CONFIG_DIR)/src/_slint.h $(SLINT_H) 102$(OBJDIR_TSTAMP): 103 -$(MKINSDIR) $(OBJDIR) 104 touch $(OBJDIR_TSTAMP) 105$(OBJDIR)/Makefile: $(OBJDIR_TSTAMP) Makefile 106 cp Makefile $(OBJDIR) 107 108# 109# These (and only these) targets are supposed to be built only in $(OBJDIR): 110# 111slsmg-module.so: $(SRCDIR)/slsmg-module.c $(CONFIG_H) 112 $(COMPILE_CMD) $(SRCDIR)/slsmg-module.c -o slsmg-module.so $(LIBS) 113rand-module.so: $(SRCDIR)/rand-module.c $(CONFIG_H) 114 $(COMPILE_CMD) $(SRCDIR)/rand-module.c -o rand-module.so $(LIBS) 115newt-module.so: $(SRCDIR)/newt-module.c $(CONFIG_H) 116 $(COMPILE_CMD) $(SRCDIR)/newt-module.c -o newt-module.so -lnewt $(LIBS) 117termios-module.so: $(SRCDIR)/termios-module.c $(CONFIG_H) 118 $(COMPILE_CMD) $(SRCDIR)/termios-module.c -o termios-module.so $(LIBS) 119select-module.so: $(SRCDIR)/select-module.c $(CONFIG_H) 120 $(COMPILE_CMD) $(SRCDIR)/select-module.c -o select-module.so $(LIBS) 121fcntl-module.so: $(SRCDIR)/fcntl-module.c $(CONFIG_H) 122 $(COMPILE_CMD) $(SRCDIR)/fcntl-module.c -o fcntl-module.so $(LIBS) 123varray-module.so: $(SRCDIR)/varray-module.c $(CONFIG_H) 124 $(COMPILE_CMD) $(SRCDIR)/varray-module.c -o varray-module.so $(LIBS) 125pcre-module.so: $(SRCDIR)/pcre-module.c $(CONFIG_H) 126 $(COMPILE_CMD) $(PCRE_INC) $(SRCDIR)/pcre-module.c -o pcre-module.so $(PCRE_LIB) $(LIBS) 127onig-module.so: $(SRCDIR)/onig-module.c $(CONFIG_H) 128 $(COMPILE_CMD) $(ONIG_INC) $(SRCDIR)/onig-module.c -o onig-module.so $(ONIG_LIB) $(LIBS) 129png-module.so: $(SRCDIR)/png-module.c $(CONFIG_H) 130 $(COMPILE_CMD) $(PNG_INC) $(SRCDIR)/png-module.c -o png-module.so $(PNG_LIB) $(LIBS) 131socket-module.so: $(SRCDIR)/socket-module.c $(CONFIG_H) 132 $(COMPILE_CMD) $(SRCDIR)/socket-module.c -o socket-module.so $(SOCKET_LIBS) $(LIBS) 133iconv-module.so: $(SRCDIR)/iconv-module.c $(CONFIG_H) 134 $(COMPILE_CMD) $(ICONV_INC) $(SRCDIR)/iconv-module.c -o iconv-module.so $(ICONV_LIB) $(LIBS) 135zlib-module.so: $(SRCDIR)/zlib-module.c $(CONFIG_H) 136 $(COMPILE_CMD) $(ZLIB_INC) $(SRCDIR)/zlib-module.c -o zlib-module.so $(ZLIB_LIB) $(LIBS) 137fork-module.so: $(SRCDIR)/fork-module.c $(CONFIG_H) 138 $(COMPILE_CMD) $(SRCDIR)/fork-module.c -o fork-module.so $(LIBS) 139sysconf-module.so: $(SRCDIR)/sysconf-module.c $(CONFIG_H) 140 $(COMPILE_CMD) $(SRCDIR)/sysconf-module.c -o sysconf-module.so $(LIBS) 141csv-module.so: $(SRCDIR)/csv-module.c $(CONFIG_H) 142 $(COMPILE_CMD) $(SRCDIR)/csv-module.c -o csv-module.so $(LIBS) 143base64-module.so: $(SRCDIR)/base64-module.c $(CONFIG_H) 144 $(COMPILE_CMD) $(SRCDIR)/base64-module.c -o base64-module.so $(LIBS) 145json-module.so: $(SRCDIR)/json-module.c $(CONFIG_H) 146 $(COMPILE_CMD) $(SRCDIR)/json-module.c -o json-module.so $(LIBS) 147# 148chksum-module.so: $(CHKSUM_OBJS) 149 $(COMPILE_CMD) $(CHKSUM_OBJS) -o chksum-module.so $(LIBS) 150chksum-module.o: $(SRCDIR)/chksum-module.c $(SRCDIR)/chksum.h 151 $(COMPILE_CMD) -c $(SRCDIR)/chksum-module.c 152chksum_md5.o: $(SRCDIR)/chksum_md5.c $(SRCDIR)/chksum.h 153 $(COMPILE_CMD) -c $(SRCDIR)/chksum_md5.c 154chksum_sha1.o: $(SRCDIR)/chksum_sha1.c $(SRCDIR)/chksum.h 155 $(COMPILE_CMD) -c $(SRCDIR)/chksum_sha1.c 156# 157histogram-module.so: $(SRCDIR)/histogram-module.c $(SRCDIR)/histogram-module.inc 158 $(COMPILE_CMD) $(SRCDIR)/histogram-module.c -o histogram-module.so $(LIBS) 159# 160stats-module.so: $(STATS_OBJS) 161 $(COMPILE_CMD) $(STATS_OBJS) -o stats-module.so $(LIBS) 162stats-module.o: $(SRCDIR)/stats-module.c $(SRCDIR)/stats-module.h 163 $(COMPILE_CMD) -c $(SRCDIR)/stats-module.c 164stats_kendall.o: $(SRCDIR)/stats_kendall.c $(SRCDIR)/stats-module.h 165 $(COMPILE_CMD) -c $(SRCDIR)/stats_kendall.c 166# 167# </targets to be built in $(OBJDIR)> 168# 169 170# Note that Windows/Cygwin modules need execute permissions 171install: all 172 -$(MKINSDIR) $(DEST_MODULEDIR) 173 @for i in $(MODULES); \ 174 do \ 175 echo $(INSTALL_MODULE) $(OBJDIR)/$$i $(DEST_MODULEDIR); \ 176 $(INSTALL_MODULE) $(OBJDIR)/$$i $(DEST_MODULEDIR); \ 177 done 178 -$(MKINSDIR) $(DEST_SLSH_DIR) 179 @for i in $(SLFILES); \ 180 do \ 181 echo $(INSTALL_DATA) $$i.sl $(DEST_SLSH_DIR); \ 182 $(INSTALL_DATA) $$i.sl $(DEST_SLSH_DIR); \ 183 done 184 @for d in statslib; \ 185 do \ 186 $(MKINSDIR) $(DEST_SLSH_DIR)/$$d; \ 187 for i in $$d/*.sl; \ 188 do \ 189 echo $(INSTALL_DATA) $$i $(DEST_SLSH_DIR)/$$d/; \ 190 $(INSTALL_DATA) $$i $(DEST_SLSH_DIR)/$$d/; \ 191 done; \ 192 done 193 -$(MKINSDIR) $(DEST_CMAPSDIR) 194 @for i in cmaps/*.map; \ 195 do \ 196 echo $(INSTALL_DATA) $$i $(DEST_CMAPSDIR); \ 197 $(INSTALL_DATA) $$i $(DEST_CMAPSDIR); \ 198 done 199 -$(MKINSDIR) $(DEST_HELPDIR) 200 @for i in help/*.hlp; \ 201 do \ 202 echo $(INSTALL_DATA) $$i $(DEST_HELPDIR); \ 203 $(INSTALL_DATA) $$i $(DEST_HELPDIR); \ 204 done 205runtests: all 206 @test_scripts="$(TEST_SCRIPTS)"; \ 207 test -z "@PNG_MODULE@" || test_scripts="$$test_scripts test_png.sl"; \ 208 test -z "@ONIG_MODULE@" || test_scripts="$$test_scripts test_onig.sl"; \ 209 test -z "@ZLIB_MODULE@" || test_scripts="$$test_scripts test_zlib.sl"; \ 210 test -z "@PCRE_MODULE@" || test_scripts="$$test_scripts test_pcre.sl"; \ 211 test -z "@ICONV_MODULE@" || test_scripts="$$test_scripts test_iconv.sl"; \ 212 test -z "@SYSCONF_MODULE@" || test_scripts="$$test_scripts test_sysconf.sl"; \ 213 cd test; ./runtests.sh $$test_scripts 214clean: 215 -/bin/rm -f $(OBJDIR_TSTAMP) 216 -cd $(OBJDIR) && /bin/rm -f $(MODULES) $(CHKSUM_OBJS) 217 -/bin/rm -f *~ */*~ 218distclean: clean 219 -/bin/rm -f Makefile $(OBJDIR)/Makefile $(CONFIG_H) 220 221.PHONY: clean distclean all install runtests 222