aboutsummaryrefslogtreecommitdiffstats
path: root/XMakefile
blob: 48d7a6c6730469812c2120b9dedcf055db0af059 (plain) (blame)
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
# $Id: XMakefile,v 1.12 2001/12/02 16:26:08 ukai Exp $
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\
	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\
	func.o cookie.o history.o backend.o $(KEYBIND_OBJ)
LSRCS=terms.c conv.c url.c ftp.c anchor.c mimehead.c parsetagx.c\
	tagtable.c istream.c
LOBJS=terms.o conv.o url.o ftp.o anchor.o mimehead.o parsetagx.o\
	tagtable.o istream.o
LLOBJS=version.o
ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o myctype.o entity.o hash.o
ALIB=libindep.a
ALLOBJS=$(OBJS) $(LOBJS) $(LLOBJS)

TARGET=w3m$(EXT)
BOOKMARKER=w3mbookmark$(EXT)
HELPER=w3mhelperpanel$(EXT)
INFLATE=inflate$(EXT)
TARGETS=$(TARGET) $(EXT_TARGETS)

SCRIPTSUBDIRS = scripts scripts/multipart scripts/w3mman
SUBDIRS = $(SCRIPTSUBDIRS)

INCLUDES=-I.

DEFS=$(INCLUDES) # -DDEBUG
CFLAGS=$(OPTS) $(MYCFLAGS) $(DEFS) 
LIBS=-L. -lindep $(GCLIB) $(MATHLIB) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES)
LIBS2=-L. -lindep $(GCLIB) $(LOCAL_LIBRARIES)
INSTALL=sh install.sh
AR=ar

all: $(TARGETS) all-scripts

$(TARGET): $(ALLOBJS) $(ALIB) $(GCTARGET)
	$(CC) $(CFLAGS) -o $(TARGET) $(ALLOBJS) $(LIBS)

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

$(OBJS): fm.h funcname1.h

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

# entity.h: html.h entity.tab mktable$(EXT)
#	./mktable 100 entity.tab > entity.h

func.o: funcname.c
keybind.o: funcname2.h
keybind_lynx.o: funcname2.h
parsetagx.o: html.c

funcname.c: funcname.tab
	sort funcname.tab | awk -f funcname0.awk > funcname.c

funcname1.h: funcname.tab
	sort funcname.tab | awk -f funcname1.awk > funcname1.h

funcname2.h: funcname.tab
	sort funcname.tab | awk -f funcname2.awk > funcname2.h

mktable$(EXT): mktable.o hash.o $(ALIB) $(GCTARGET)
	$(CC) $(CFLAGS) -o mktable$(EXT) mktable.o hash.o  $(LIBS2)

$(BOOKMARKER): w3mbookmark.o $(ALIB) $(GCTARGET)
	$(CC) $(CFLAGS) -o $(BOOKMARKER) w3mbookmark.o  $(LIBS2)

$(HELPER): w3mhelperpanel.o $(ALIB) $(GCTARGET)
	$(CC) $(CFLAGS) -o $(HELPER) w3mhelperpanel.o  $(LIBS2)

$(INFLATE): inflate.o
	$(CC) $(CFLAGS) $(Z_CFLAGS) -o $(INFLATE) inflate.o $(ZLIB)

inflate.o: inflate.c
	$(CC) $(CFLAGS) $(Z_CFLAGS) -c inflate.c

gc/gc.a:
	cd gc; $(MAKE) CC='$(CC)' CFLAGS='$(GCCFLAGS) $(GC_CFLAGS)' SPECIALCFLAGS='-I./\$(srcdir)/include $(GC_CFLAGS)'


install: install-core install-scripts

install-core: $(TARGETS)
	-$(MKDIR) $(DESTDIR)$(BIN_DIR)
	-$(MKDIR) $(DESTDIR)$(HELP_DIR)
	-$(MKDIR) $(DESTDIR)$(LIB_DIR)
	$(INSTALL) -m 755 $(TARGET) $(DESTDIR)$(BIN_DIR)/$(TARGET)
	$(INSTALL) -m 644 $(HELP_FILE) $(DESTDIR)$(HELP_DIR)/w3mhelp.html
	for d in $(EXT_TARGETS); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done

install-helpfile:
	$(INSTALL) -m 644 w3mhelp-w3m_en.html $(DESTDIR)$(HELP_DIR)/w3mhelp-w3m_en.html
	$(INSTALL) -m 644 w3mhelp-w3m_ja.html $(DESTDIR)$(HELP_DIR)/w3mhelp-w3m_ja.html
	$(INSTALL) -m 644 w3mhelp-lynx_en.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_en.html
	$(INSTALL) -m 644 w3mhelp-lynx_ja.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_ja.html

all-scripts:
	for dir in $(SCRIPTSUBDIRS);	\
	do	\
		(cd $$dir; $(MAKE) PERL='$(PERL)' BIN_DIR='$(BIN_DIR)' LIB_DIR='$(LIB_DIR)' HELP_DIR='$(HELP_DIR)');	\
	done

install-scripts: all-scripts
	for dir in $(SCRIPTSUBDIRS);	\
	do	\
		TOPDIR=`pwd`; \
		(cd $$dir; $(MAKE) PERL='$(PERL)' BIN_DIR='$(BIN_DIR)' LIB_DIR='$(LIB_DIR)' HELP_DIR='$(HELP_DIR)' DESTDIR='$(DESTDIR)' INSTALL="sh $$TOPDIR/install.sh" install);	\
	done

uninstall:
	-$(RM) $(BIN_DIR)/$(TARGET)
	-$(RM) $(HELP_DIR)/w3mhelp-lynx_en.html
	-$(RM) $(HELP_DIR)/w3mhelp-lynx_ja.html
	-$(RM) $(HELP_DIR)/w3mhelp-w3m_en.html 
	-$(RM) $(HELP_DIR)/w3mhelp-w3m_ja.html 
	-$(RM) $(HELP_DIR)/w3mhelp.html
	-$(RM) $(LIB_DIR)/$(BOOKMARKER)
	-$(RM) $(LIB_DIR)/$(HELPER)
	-$(RM) $(LIB_DIR)/$(INFLATE)

clean: sweep
	rm -f *.o *.a $(TARGETS) mktable$(EXT)
	rm -f funcname.c funcname1.h funcname2.h tagtable.c
	for dir in $(SCRIPTSUBDIRS);	\
	do	\
		(cd $$dir; $(MAKE) clean); \
	done

sweep:
	-rm -f core *~ *.bak *.orig *.rej

depend: 
	makedepend $(CFLAGS) *.c

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

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

# DO NOT DELETE