1
2# Here is a makefile for VTWM.
3#
4# It's a hand-tweaked version of the makefile made with xmkmf,
5# it may prove useful as a template for those who don't have xmkmf.
6#
7# This makefile guarantees that the build info is absolutely current.
8#
9# djhjr
10
11# =============== Start of common editables =====================
12
13# To omit XPM image support, uncomment this
14#XPM_DEFINE = -DNO_XPM_SUPPORT
15# and comment these
16XPMLIB = -lXpm
17XPMINC =
18# (version 3.4h of the XPM library is the earliest supported I know of)
19
20# To omit regular expressions ("RE"s) support, uncomment this
21#REGEX_DEFINE = -DNO_REGEX_SUPPORT
22# and comment these
23REGEXLIB =
24REGEXINC =
25# (the library must conform to the POSIX 1003.2 specification)
26
27# To omit sound support. uncomment this
28SOUND_DEFINE = -DNO_SOUND_SUPPORT
29# and comment these
30#SOUNDLIB = -L/usr/local/lib -lrplay
31#SOUNDINC = -I/usr/local/include
32# (sound is supported only by way of the rplay library)
33
34# To omit m4 pre-processing of resource files, uncomment this
35#M4_DEFINE = -DNO_M4_SUPPORT
36
37# To omit platform and build info in the version window, uncomment this
38#INFO_DEFINE = -DNO_BUILD_INFO
39
40# For lexers that don't track line numbers, uncomment this
41YYLINENO_DEFINE = -DNEED_YYLINENO_V
42
43# For those systems that don't have putenv(), uncomment this
44PUTENV_DEFINE = -DNEED_PUTENV_F
45
46# For those systems that require sys/select.h, uncomment this
47SELECT_DEFINE = -DNEED_SELECT_H
48
49# For those systems that require process.h, uncomment this
50PROCESS_DEFINE = -DNEED_PROCESS_H
51
52# Installation path for the binary
53VTWMBINDIR = /usr/bin/X11
54
55# Installation path for the system resource file
56VTWMLIBDIR = /usr/lib/X11/twm
57
58# Installation path for the man page
59VTWMMANDIR = /usr/man/mann
60
61# For the traditional look of TWM as the system fallback,
62# change this to "2D"
63SYS_VTWMRC_LOOK = 3D
64
65CDEBUGFLAGS = -w4 -M
66CCOPTIONS = -Otx -zp1 -mf -b -j -Wc,-s -N32k
67
68# ================ End of common editables ======================
69
70# ============= Start of less common editables ==================
71
72CP = cp -f
73MV = mv -f
74RM = rm -f
75LN = ln -fs
76CC = cc
77LEX = lex
78YACC = yacc
79
80YFLAGS = -d
81
82USRLIBDIR = /usr/lib/X11
83
84# Handy for developers to check man page editions
85# (see the end of this file)
86DEROFF = deroff
87DW = dw
88SPELL = spell
89
90# Required to generate HTML or Postscript versions of the man page
91# (see the end of this file)
92MAN2HTML = man2html
93MAN2PS = man2ps
94
95# ============== End of less common editables ===================
96
97# ========= Editing below here should not be necessary ==========
98
99XMULIB = -lXmu
100XTOOLLIB =
101EXTENSIONLIB = -lXext
102XLIB = $(EXTENSIONLIB) -lX11_s
103
104LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) $(XLIB) \
105                  $(XPMLIB) $(REGEXLIB) $(SOUNDLIB)
106EXTRA_LIBRARIES = -lXqnx -lsocket
107LDLIBS = $(LOCAL_LIBRARIES) $(EXTRA_LIBRARIES)
108
109INCLUDES =
110EXTRA_INCLUDES = $(XPMINC) $(REGEXINC) $(SOUNDINC)
111STD_INCLUDES =
112
113ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(STD_INCLUDES)
114
115STD_DEFINES = -D__QNX__ -DMetroLink -DSTRINGS_ALIGNED -DNO_REGEX \
116              -DBOGUS_MB_MAX
117EXTRA_DEFINES = $(XPM_DEFINE) $(SOUND_DEFINE) $(REGEX_DEFINE) \
118                $(M4_DEFINE) $(INFO_DEFINE) \
119                $(YYLINENO_DEFINE) $(PUTENV_DEFINE) $(SELECT_DEFINE) \
120                $(PROCESS_DEFINE)
121PROTO_DEFINES =
122
123ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES)
124
125CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) -L$(USRLIBDIR)
126
127SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c twm.c sound.c \
128	parse.c menus.c events.c resize.c util.c version.c iconmgr.c \
129	cursor.c regions.c applets.c icons.c desktop.c doors.c lastmake.c
130
131OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o twm.o sound.o \
132	parse.o menus.o events.o resize.o util.o version.o iconmgr.o \
133	cursor.o regions.o applets.o icons.o desktop.o doors.o lastmake.o
134
135PROGRAM = vtwm
136
137all: vtwm
138
139depend: lex.c gram.c deftwmrc.c lastmake.c
140
141install:
142	$(CP) $(PROGRAM) $(VTWMBINDIR)
143	$(CP) system.vtwmrc $(VTWMLIBDIR)
144	$(CP) doc/vtwm.man $(VTWMMANDIR)
145
146clean:
147	$(RM) $(PROGRAM) *.o *.b *.err *.map y.tab.h y.tab.c lex.yy.c \
148	gram.h gram.c lex.c deftwmrc.c lastmake.c system.vtwmrc \
149	vtwm.dw vtwm.ser vtwm.html vtwm.ps
150
151vtwm: $(OBJS)
152	$(RM) $@
153	$(CC) -o $@ $(OBJS) $(CFLAGS) $(LDLIBS)
154	$(RM) deftwmrc.* lastmake.*
155
156parse.o: gram.h
157	$(RM) $@
158	$(CC) -c $(CFLAGS) '-DSYSTEM_VTWMRC="'$(VTWMLIBDIR)'/system.vtwmrc"' \
159	'-DSYSTEM_TWMRC="'$(VTWMLIBDIR)'/system.twmrc"' parse.c
160
161add_window.o applets.o events.o icons.o list.o menus.o \
162regions.o sound.o twm.o util.o: gram.h
163	$(RM) $@
164	$(CC) -c $(CFLAGS) $*.c
165
166lex.o: gram.h
167
168gram.h gram.c: gram.y
169	$(YACC) $(YFLAGS) gram.y
170	$(MV) y.tab.c gram.c
171	$(MV) y.tab.h gram.h
172
173deftwmrc.c:  system.vtwmrc
174	$(RM) $@
175	echo '/* ' >>$@
176	echo ' * This file is generated automatically from the default' >>$@
177	echo ' * VTWM bindings file system.vtwmrc.'$(SYS_VTWMRC_LOOK)' by the VTWM Makefile.' >>$@
178	echo ' */' >>$@
179	echo '' >>$@
180	echo 'char *defTwmrc[] = {' >>deftwmrc.c
181	sed -e '/^$$/d' -e '/^#/d' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/",/' -e 's/[	]\{1,\}/ /g' -e 's/^" /"/' system.vtwmrc >>$@
182	echo '(char *)0 };' >>$@
183
184lastmake.c:
185	$(RM) $@
186	echo '/* ' >>$@
187	echo ' * This file is generated automatically by the VTWM Makefile.' >>$@
188	echo ' */' >>$@
189	echo '' >>$@
190	echo 'char *lastmake[] = {' >>lastmake.c
191	echo '    "Platform:  '`uname -r -s`'",' >>$@
192	echo '    "Build:  '`date`'",' >>$@
193	echo '    "" };' >>$@
194
195system.vtwmrc:
196	$(RM) $@
197	$(CP) $@.$(SYS_VTWMRC_LOOK) $@
198
199# Handy for developers to check the man page
200dw vtwm.dw: doc/vtwm.man
201	$(DEROFF) doc/vtwm.man | $(DW) >vtwm.dw
202	@if test -s vtwm.dw ; \
203	then \
204	    echo Doubled words in vtwm.man ... ; \
205	    cat vtwm.dw ; \
206	fi
207spell vtwm.ser: doc/vtwm.man vtwm.sok
208	$(DEROFF) doc/vtwm.man | $(SPELL) +vtwm.sok >vtwm.ser
209	@if test -s vtwm.ser ; \
210	then \
211	    echo Spelling exceptions in vtwm.man ... ; \
212	    cat vtwm.ser ; \
213	fi
214
215# If you wish to generate HTML or Postscript versions of the man page,
216# enter 'make vtwm.html' or 'make vtwm.ps'
217vtwm.html: doc/vtwm.man
218	$(MAN2HTML) doc/vtwm.man
219vtwm.ps: doc/vtwm.man
220	$(MAN2PS) < $< >$@
221