Makefile.in 8.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#
# Makefile
# @configure_input@
#
@SET_MAKE@
SHELL=@SHELL@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
DOMAIN = $(PACKAGE)
prefix = @prefix@
exec_prefix = @exec_prefix@
12
datarootdir = @datarootdir@
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
bindir = @bindir@
datadir = @datadir@
localedir = $(datadir)/locale
libdir = @libdir@
includedir = @includedir@
infodir = @infodir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
top_srcdir = @top_srcdir@
top_builddir = .
VPATH = $(top_srcdir):.

CGIBIN_DIR = $(libexecdir)/$(PACKAGE)/cgi-bin
AUXBIN_DIR = $(libexecdir)/$(PACKAGE)
HELP_DIR = @HELP_DIR@
RC_DIR = @RC_DIR@
ETC_DIR = $(sysconfdir)
CONF_DIR = $(sysconfdir)/$(PACKAGE)

CFLAGS = $(OPTS) -I. -I$(top_srcdir) @CFLAGS@ $(CPPFLAGS) $(DEFS)
WCCFLAGS = @WCCFLAGS@
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@ -DAUXBIN_DIR=\"$(AUXBIN_DIR)\" \
	-DCGIBIN_DIR=\"$(CGIBIN_DIR)\" -DHELP_DIR=\"$(HELP_DIR)\" \
	-DETC_DIR=\"$(ETC_DIR)\" -DCONF_DIR=\"$(CONF_DIR)\" \
	-DRC_DIR=\"$(RC_DIR)\" \
        -DLOCALEDIR=\"$(localedir)\"
LDFLAGS = @LDFLAGS@
47
LIBS = @LIBS@
48 49
GC_LIBS = @LIBGC@
EXT_LIBS = -L. -lindep @LIBINTL@ $(GC_LIBS)
50 51 52 53 54 55 56 57 58 59 60
W3M_LIBS = @W3M_LIBS@
WCTARGET = @WCTARGET@
NLSTARGET = @NLSTARGET@

MAKE_ARGS = PERL='$(PERL)' MKDIR='$(MKDIR)' \
	BIN_DIR='$(bindir)' AUXBIN_DIR='$(AUXBIN_DIR)' \
	CGIBIN_DIR='$(CGIBIN_DIR)' \
	HELP_DIR='$(HELP_DIR)' MAN_DIR='$(mandir)' ETC_DIR='$(ETC_DIR)' \
	CONF_DIR='$(CONF_DIR)' \
	RC_DIR='$(RC_DIR)' DESTDIR='$(DESTDIR)' KEYBIND_SRC='$(KEYBIND_SRC)'

61 62
IMGCFLAGS = @IMGX11CFLAGS@ @IMGFBCFLAGS@ @IMGWINCFLAGS@
IMGLDFLAGS = @IMGX11LDFLAGS@ @IMGFBLDFLAGS@ @IMGWINLDFLAGS@
63 64

CC0 = @CC@
65 66
CXX = @CXX@
IMGLINK = @IMGLINK@
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
CC = @POSUBST@ $(CC0)
CPP = @CPP@
RANLIB=@RANLIB@
AWK = @AWK@
PERL = @PERL@
MKDIR=mkdir -p
MV=mv
RM=rm
AR=ar
INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_SCRIPT=@INSTALL_SCRIPT@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_W3MIMGDISPLAY=@INSTALL_W3MIMGDISPLAY@

HELP_FILE = @HELP_FILE@
KEYBIND_SRC = @KEYMAP_FILE@.c
KEYBIND_OBJ = @KEYMAP_FILE@.o

VERSION=@CURRENT_VERSION@
MODEL=@W3M_TARGET@-@W3M_LANG@

SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \
	form.c map.c frame.c rc.c menu.c mailcap.c image.c \
	symbol.c entity.c terms.c url.c ftp.c mimehead.c regex.c news.c \
	func.c cookie.c history.c backend.c $(KEYBIND_SRC)
OBJS=main.o file.o buffer.o display.o etc.o search.o linein.o table.o local.o\
	form.o map.o frame.o rc.o menu.o mailcap.o image.o \
	symbol.o entity.o terms.o url.o ftp.o mimehead.o regex.o news.o \
	func.o cookie.o history.o backend.o $(KEYBIND_OBJ)
LSRCS=anchor.c parsetagx.c tagtable.c istream.c
LOBJS=anchor.o parsetagx.o tagtable.o istream.o
LLOBJS=version.o
ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o myctype.o hash.o
ALIB=libindep.a
ALLOBJS=$(OBJS) $(LOBJS) $(LLOBJS)

EXT=@EXEEXT@

TARGET=$(PACKAGE)$(EXT)
BOOKMARKER=w3mbookmark$(EXT)
HELPER=w3mhelperpanel$(EXT)
INFLATE=inflate$(EXT)
IMGDISPLAY=w3mimgdisplay$(EXT)
MAN1_TARGET=$(PACKAGE).1
MAN1=$(top_srcdir)/doc/w3m.1
MAN1_JA=$(top_srcdir)/doc-jp/w3m.1

LIB_TARGETS=$(BOOKMARKER) $(HELPER)
AUXBIN_TARGETS=@AUXBIN_TARGETS@
TARGETS=$(TARGET) $(LIB_TARGETS) $(AUXBIN_TARGETS)
HELP_TARGET=w3mhelp.html
HELP_ALLFILES=w3mhelp-w3m_en.html w3mhelp-w3m_ja.html \
	w3mhelp-lynx_en.html w3mhelp-lynx_ja.html

DEFUNS=$(top_srcdir)/main.c $(top_srcdir)/menu.c
SCRIPTSUBDIRS= scripts
SUBDIRS = $(SCRIPTSUBDIRS) w3mimg libwc po
.PHONY: $(SUBDIRS)

all: $(TARGETS) all-scripts $(NLSTARGET)

$(TARGET): $(ALLOBJS) $(ALIB) $(WCTARGET)
130
	$(CC) $(CFLAGS) -o $(TARGET) $(ALLOBJS) $(LDFLAGS) $(LIBS) $(EXT_LIBS) $(W3M_LIBS)
131 132 133 134 135 136 137 138 139 140

$(ALIB): $(ALIBOBJS)
	$(AR) rv $(ALIB) $(ALIBOBJS)
	$(RANLIB) $(ALIB)

$(OBJS) $(LOBJS): fm.h funcname1.h

tagtable.c: tagtable.tab mktable$(EXT) html.h 
	./mktable$(EXT) 100 $(srcdir)/tagtable.tab > $@

141 142 143 144 145
entity.h: entity.tab mktable$(EXT)
	echo '/* $$I''d$$ */' > $@
	./mktable$(EXT) 100 $(srcdir)/entity.tab >> $@

indep.o: indep.c fm.h funcname1.h entity.h
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
func.o: funcname.c functable.c funcname1.h
keybind.o: funcname2.h
keybind_lynx.o: funcname2.h
parsetagx.o: html.c

funcname.tab: $(DEFUNS)
	(echo '#define DEFUN(x,y,z) x y';\
	 sed -ne '/^DEFUN/{p;n;/^[ 	]/p;}' $(DEFUNS)) | $(CPP) - | \
	 awk '$$1 ~ /^[_A-Za-z]/ { \
	       for (i=2;i<=NF;i++) { print $$i, $$1} \
	 }' > $@.tmp
	@if cmp -s $@.tmp $@; then \
		echo "$@ unchanged"; \
		rm -f $@.tmp; \
	else \
		echo "$@ updated"; \
		mv $@.tmp $@; \
	fi

funcname.c: funcname.tab
	sort funcname.tab | $(AWK) -f $(top_srcdir)/funcname0.awk > $@

funcname1.h: funcname.tab
	sort funcname.tab | $(AWK) -f $(top_srcdir)/funcname1.awk > $@

funcname2.h: funcname.tab
	sort funcname.tab | $(AWK) -f $(top_srcdir)/funcname2.awk > $@

functable.c: funcname.tab mktable$(EXT)
	sort funcname.tab | $(AWK) -f $(top_srcdir)/functable.awk > functable.tab
	./mktable$(EXT) 100 functable.tab > $@
	-rm -f functable.tab

179 180
mktable$(EXT): mktable.o dummy.o Str.o hash.o myctype.o
	$(CC) $(CFLAGS) -o mktable mktable.o dummy.o Str.o hash.o myctype.o $(LDFLAGS) $(LIBS) $(GC_LIBS)
181 182

$(BOOKMARKER): w3mbookmark.o dummy.o $(ALIB)
183
	$(CC) $(CFLAGS) -o $(BOOKMARKER) w3mbookmark.o dummy.o $(LDFLAGS) $(LIBS) $(EXT_LIBS)
184 185

$(HELPER): w3mhelperpanel.o dummy.o $(ALIB)
186 187
	$(CC) $(CFLAGS) -o $(HELPER) w3mhelperpanel.o dummy.o $(LDFLAGS) $(LIBS) $(EXT_LIBS)

188 189 190 191 192 193
$(INFLATE): inflate.o $(ALIB)
	$(CC) $(CFLAGS) -o $(INFLATE) inflate.o $(LDFLAGS) $(LIBS) -lz

inflate.o: inflate.c
	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/inflate.c

194 195
libwc/libwc.a: libwc
libwc:
196 197 198 199 200 201
	(cd libwc && $(MAKE) CC='$(CC0)' OPTS='$(OPTS)')
 
dummy.o: entity.c
	$(CC) $(CFLAGS) -DDUMMY -c -o $@ $?

$(IMGDISPLAY): w3mimgdisplay.o $(ALIB) w3mimg/w3mimg.a
202
	$(IMGLINK) $(CFLAGS) -o $(IMGDISPLAY) w3mimgdisplay.o w3mimg/w3mimg.a $(LDFLAGS) $(LIBS) -lX11 $(IMGLDFLAGS)
203 204 205 206

w3mimgdisplay.o: w3mimgdisplay.c w3mimg/w3mimg.h
	$(CC) $(CFLAGS) $(IMGCFLAGS) -o $@ -c $(srcdir)/w3mimgdisplay.c

207 208
w3mimg/w3mimg.a: w3mimg
w3mimg:
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
	(cd w3mimg && $(MAKE) CC="$(CC0)" OPTS="$(OPTS)")

po:
	(cd $@ && $(MAKE))

install: install-core install-scripts install-po

install-core: $(TARGETS)
	-$(MKDIR) $(DESTDIR)$(bindir)
	-$(MKDIR) $(DESTDIR)$(AUXBIN_DIR)
	-$(MKDIR) $(DESTDIR)$(CGIBIN_DIR)
	-$(MKDIR) $(DESTDIR)$(HELP_DIR)
	-$(MKDIR) $(DESTDIR)$(mandir)/man1
	-$(MKDIR) $(DESTDIR)$(mandir)/ja/man1
	$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(bindir)/$(TARGET)
	$(INSTALL_DATA) $(HELP_FILE) $(DESTDIR)$(HELP_DIR)/$(HELP_TARGET)
	$(INSTALL_DATA) $(MAN1) $(DESTDIR)$(mandir)/man1/$(MAN1_TARGET)
	$(INSTALL_DATA) $(MAN1_JA) $(DESTDIR)$(mandir)/ja/man1/$(MAN1_TARGET)
	targets="$(AUXBIN_TARGETS)"; for file in $$targets; \
	do \
		case $$file in \
		$(IMGDISPLAY)) $(INSTALL_W3MIMGDISPLAY) $$file \
			$(DESTDIR)$(AUXBIN_DIR)/$$file;; \
		*) $(INSTALL_PROGRAM) $$file $(DESTDIR)$(AUXBIN_DIR)/$$file;; \
		esac; \
	done
	for file in $(LIB_TARGETS); \
	do \
		$(INSTALL_PROGRAM) $$file $(DESTDIR)$(CGIBIN_DIR)/$$file; \
	done

install-helpfile:
	-$(MKDIR) $(DESTDIR)$(HELP_DIR)
	for file in $(HELP_ALLFILES); \
	do \
		$(INSTALL_DATA) $$file $(DESTDIR)$(HELP_DIR)/$$file; \
	done

install-po:
	NLSTARGET="$(NLSTARGET)"; for subdir in $$NLSTARGET; \
	do \
	 (cd $$subdir && $(MAKE) install); \
	done

253
all-scripts: funcname.tab
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
	for dir in $(SCRIPTSUBDIRS);	\
	do	\
		(cd $$dir && $(MAKE) $(MAKE_ARGS)); \
	done

install-scripts: all-scripts
	topdir=`pwd`; \
	for dir in $(SCRIPTSUBDIRS);	\
	do	\
		(cd $$dir && $(MAKE) $(MAKE_ARGS) install); \
	done

uninstall:
	-$(RM) $(bindir)/$(TARGET)
	-for file in $(AUXBIN_TARGETS); \
	do \
		$(RM) -f $(AUXBIN_DIR)/$$file; \
	done
	-for file in $(LIB_TARGETS); \
	do \
		$(RM) -f $(CGIBIN_DIR)/$$file; \
	done
	-for file in $(HELP_ALLFILES); \
	do \
		$(RM) -f $(HELP_DIR)/$$file; \
	done
	-$(RM) -f $(HELP_DIR)/$(HELP_TARGET)
	-$(RM) -f $(mandir)/man1/$(MAN1_TARGET)
	-$(RM) -f $(mandir)/ja/man1/$(MAN1_TARGET)
	-for dir in $(SCRIPTSUBDIRS);	\
	do	\
		(cd $$dir && $(MAKE) $(MAKE_ARGS) uninstall); \
	done

clean: sweep
	-$(RM) -f *.o *.a $(TARGETS) mktable$(EXT)
	-$(RM) -f funcname.tab
291
	-$(RM) -f entity.h
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
	-$(RM) -f funcname.c funcname1.h funcname2.h tagtable.c functable.c
	-for dir in w3mimg libwc; \
	do \
		(cd $$dir && $(MAKE) clean RM="$(RM)"); \
	done
	-for dir in $(SCRIPTSUBDIRS);	\
	do	\
		(cd $$dir && $(MAKE) clean); \
	done

distclean: clean
	for subdir in po scripts w3mimg libwc; \
	do \
		(cd $$subdir && $(MAKE) distclean); \
	done
	-$(RM) -f config.cache config.log config.status
	-$(RM) -f w3mhelp-w3m_en.html w3mhelp-w3m_ja.html
	-$(RM) -f w3mhelp-lynx_en.html w3mhelp-lynx_ja.html
	-$(RM) -f version.c
	-$(RM) -f posubst
	-$(RM) -f config.h Makefile
	-$(RM) -f *core

sweep:
	-$(RM) -f core *~ *.bak *.orig *.rej

depend: 
	makedepend $(CFLAGS) *.c

dist:
	cd ..; tar cvfz w3m-$(VERSION).tar.gz w3m

bindist:
	cd ..; tar cvfz w3m-$(VERSION)-$(MODEL).tar.gz w3m/w3m* w3m/doc* w3m/Bonus* w3m/README w3m/scripts