1# retawq/Makefile - classical-style Makefile 2# This file is part of retawq (<http://retawq.sourceforge.net/>), a network 3# client created by Arne Thomassen; retawq is basically released under certain 4# versions of the GNU General Public License and WITHOUT ANY WARRANTY. 5# Read the file COPYING for license details, README for program information. 6# Copyright (C) 2001-2006 Arne Thomassen <arne@arne-thomassen.de> 7 8# Part A. You might want to change the following settings; 9# read retawq/docu/ctconfig.html for documentation. 10 11# text/graphics mode (curses, ncurses, bicurses, xcurses, ...) 12OPTION_TG = ncurses 13 14# text-mode mouse 15OPTION_TEXTMODEMOUSE = 1 16 17# i18n (internationalization) 18OPTION_I18N = 0 19 20# quality of character entity display 21OPTION_CED = 1 22 23# HTTP cookies 24OPTION_COOKIES = 1 25 26# News/NNTP schemes 27OPTION_NEWS = 1 28 29# local CGI scheme 30OPTION_LOCAL_CGI = 0 31 32# whether external programs (besides any local CGI scripts) may be executed 33OPTION_EXECEXT = 0 34 35# TLS/SSL (0=disabled, 1=GnuTLS, 2=OpenSSL) 36OPTION_TLS = 0 37 38# IPv6 support 39OPTION_IPV6 = 0 40 41# threading: 0 means none (DNS hostname lookups will "block" the whole 42# program so that it will seem to hang), 1 means OS-independent pthreads 43# library, 2 means Linux-specific clone() syscall 44OPTION_THREADING = 1 45 46# whether a built-in run-time configuration file shall be used 47OPTION_BIRTCFG = 0 48 49# paths for "make install"; don't add a trailing "/"! 50PATH_INSTALL_PREFIX = /usr/local 51PATH_INSTALL_BIN = $(PATH_INSTALL_PREFIX)/bin 52PATH_INSTALL_MAN = $(PATH_INSTALL_PREFIX)/man 53PATH_INSTALL_DOC = $(PATH_INSTALL_PREFIX)/doc/retawq 54PATH_INSTALL_LOCALE = $(PATH_INSTALL_PREFIX)/share/locale 55 56# put your favourite C compiler here; mine is "gcc" 57CC = gcc 58 59# compiler flags; "-O2" is the code optimization level for gcc 60ifeq ($(CC), gcc) 61CFLAGS = -O2 62else 63CFLAGS = 64endif 65 66# flags for multi-threading 67ifeq ($(OPTION_THREADING), 0) 68# nothing 69else 70CFLAGS += -D_REENTRANT -D_THREAD_SAFE 71endif 72 73 74# Part B. Don't change any of the following! 75 76# e-mail protocols 77OPTION_POP = 0 78OPTION_IMAP = 0 79OPTION_SMTP = 0 80 81# other stuff 82OPTION_TRAP = 0 83OPTION_BUILTIN_DNS = 0 84OPTION_EXECINT = 0 85OPTION_POLL = 0 86CONFIG_MENUS = 32767 87CONFIG_KEYMAPS = 1 88CONFIG_LOCALDIR = 2 89CONFIG_FTPDIR = 1 90CONFIG_RTCONFIG = 1 91CONFIG_SESSIONS = 1 92CONFIG_JUMPS = 1 93CONFIG_CONSOLE = 1 94CONFIG_HTTP = 32767 95CONFIG_FTP = 1 96CONFIG_FINGER = 1 97CONFIG_GOPHER = 0 98CONFIG_ABOUT = 32767 99CONFIG_USER_QUERY = 1 100CONFIG_BLOAT = 32767 101CONFIG_EXTRA = 32767 102CONFIG_WK = 32767 103CONFIG_DISK_CACHE = 0 104CONFIG_HTML = 32767 105CONFIG_PLATFORM = 0 106CONFIG_JAVASCRIPT = 0 107CONFIG_CSS = 0 108CONFIG_DEBUG = 0 109 110# enable useful warnings for gcc 111# CHECKME: re-enable "-Wtraditional" as soon as the dumb warning flood for the 112# MD5 algorithm constants can be stopped somehow 113ifeq ($(CONFIG_DEBUG), 1) 114ifeq ($(CC), gcc) 115CFLAGS += -Wall -W -Wchar-subscripts -Wbad-function-cast -Wmissing-prototypes -Wcast-align -Wshadow -Wwrite-strings -Waggregate-return -Winline -ggdb # -Wpointer-arith -Wundef -Wmissing-noreturn # -Wcast-qual -Wredundant-decls # -Wpadded -Wunreachable-code # -Wconversion # -pedantic 116endif 117endif 118 119# object files 120OBJS = main.o resource.o parser.o init.o stuff.o $(shell tool/tgmode --objs $(OPTION_TG)) 121 122# handle TLS 123ifeq ($(OPTION_TLS), 0) 124LTLS = 125else 126CFLAGS += $(shell tool/tlsmode --cflags $(OPTION_TLS)) 127LTLS = $(shell tool/tlsmode --libs $(OPTION_TLS)) 128endif 129 130ifeq ($(CONFIG_JAVASCRIPT), 1) 131OBJS += javascript.o 132LCLM = -lm 133else 134LCLM = 135endif 136 137ifeq ($(OPTION_THREADING), 1) 138PTHREAD_LIBS = -lpthread 139else 140PTHREAD_LIBS = 141endif 142 143RETAWQ_VERSION = 0.2.6c 144 145build_binary: msgpre clean config retawqbin stripsyms msgpost 146 147devel: clean config retawqbin 148 149config: 150 @tool/tgmode --init $(OPTION_TG) || { (exit 1); exit 1; } 151 @echo "/* Auto-generated by retawq/Makefile, do not edit */" >.config 152 @echo "#define USING_CONFIGURE 0" >>.config 153# configure script simulation... 154 @echo "#define STDC_HEADERS 1" >>.config 155 @echo "#define HAVE_BCOPY 1" >>.config 156 @echo "#define HAVE_BZERO 1" >>.config 157 @echo "#define HAVE_CURSES_RESIZETERM 1" >>.config 158 @echo "#define HAVE_DUP2 1" >>.config 159 @echo "#define HAVE_GETADDRINFO 1" >>.config 160 @echo "#define HAVE_GETCWD 1" >>.config 161 @echo "#define HAVE_GETNAMEINFO 1" >>.config 162 @echo "#define HAVE_GETIPNODEBYNAME 0" >>.config 163 @echo "#define HAVE_GETTIMEOFDAY 1" >>.config 164 @echo "#define HAVE_INET_ADDR 1" >>.config 165 @echo "#define HAVE_INET_NTOP 1" >>.config 166 @echo "#define HAVE_INET_PTON 1" >>.config 167 @echo "#define HAVE_MEMCPY 1" >>.config 168 @echo "#define HAVE_MEMSET 1" >>.config 169 @echo "#define HAVE_MMAP 1" >>.config 170 @echo "#define HAVE_PUTENV 1" >>.config 171 @echo "#define HAVE_SETENV 1" >>.config 172 @echo "#define HAVE_SIGACTION 1" >>.config 173 @echo "#define HAVE_SIGDELSET 1" >>.config 174 @echo "#define HAVE_SIGFILLSET 1" >>.config 175 @echo "#define HAVE_SIGPROCMASK 1" >>.config 176 @echo "#define HAVE_STRCASECMP 1" >>.config 177 @echo "#define HAVE_STRNCASECMP 1" >>.config 178 @echo "#define HAVE_STRCHR 1" >>.config 179 @echo "#define HAVE_STRERROR 1" >>.config 180 @echo "#define HAVE_STRRCHR 1" >>.config 181 @echo "#define HAVE_STRSTR 1" >>.config 182 @echo "#define HAVE_UNAME 1" >>.config 183 @echo "#define HAVE_WAIT3 0" >>.config 184 @echo "#define HAVE_WAITPID 1" >>.config 185 @echo "#define HAVE_ARPA_INET_H 1" >>.config 186 @echo "#define HAVE_DIRENT_H 1" >>.config 187 @echo "#define HAVE_ERRNO_H 1" >>.config 188 @echo "#define HAVE_FCNTL_H 1" >>.config 189 @echo "#define HAVE_LIBINTL_H 1" >>.config 190 @echo "#define HAVE_LIMITS_H 1" >>.config 191 @echo "#define HAVE_MEMORY_H 1" >>.config 192 @echo "#define HAVE_NDIR_H 1" >>.config 193 @echo "#define HAVE_NETDB_H 1" >>.config 194 @echo "#define HAVE_NETINET_IN_H 1" >>.config 195 @echo "#define HAVE_STDARG_H 1" >>.config 196# @echo "#define HAVE_STDINT_H 1" >>.config 197 @echo "#define HAVE_STDLIB_H 1" >>.config 198 @echo "#define HAVE_STRINGS_H 1" >>.config 199 @echo "#define HAVE_STRING_H 1" >>.config 200 @echo "#define HAVE_SYS_DIR_H 1" >>.config 201 @echo "#define HAVE_SYS_IOCTL_H 1" >>.config 202 @echo "#define HAVE_SYS_NDIR_H 1" >>.config 203 @echo "#define HAVE_SYS_POLL_H 1" >>.config 204 @echo "#define HAVE_SYS_SELECT_H 1" >>.config 205 @echo "#define HAVE_SYS_SOCKET_H 1" >>.config 206 @echo "#define HAVE_SYS_STAT_H 1" >>.config 207 @echo "#define HAVE_SYS_TIME_H 1" >>.config 208 @echo "#define HAVE_SYS_TYPES_H 1" >>.config 209 @echo "#define HAVE_SYS_WAIT_H 1" >>.config 210 @echo "#define HAVE_TERMIOS_H 1" >>.config 211 @echo "#define HAVE_UNISTD_H 1" >>.config 212 @echo "#define HAVE_VARARGS_H 0" >>.config 213# ...and the real stuff 214 @echo "#define RETAWQ_VERSION \"$(RETAWQ_VERSION)\"" >>.config 215 @echo "#define OPTION_TG $(OPTION_TG)" >>.config # just to see... 216 @echo "#define CONFIG_TG `tool/tgmode --cftg $(OPTION_TG)`" >>.config 217 @echo "#define OPTION_TEXTMODEMOUSE $(OPTION_TEXTMODEMOUSE)" >>.config 218 @echo "#define OPTION_CED $(OPTION_CED)" >>.config 219 @echo "#define OPTION_COOKIES $(OPTION_COOKIES)" >>.config 220 @echo "#define OPTION_LOCAL_CGI $(OPTION_LOCAL_CGI)" >>.config 221 @echo "#define OPTION_EXECEXT $(OPTION_EXECEXT)" >>.config 222 @echo "#define OPTION_TLS $(OPTION_TLS)" >>.config 223 @echo "#define OPTION_IPV6 $(OPTION_IPV6)" >>.config 224 @echo "#define OPTION_I18N $(OPTION_I18N)" >>.config 225 @echo "#define OPTION_NEWS $(OPTION_NEWS)" >>.config 226 @echo "#define PATH_INSTALL_DOC \"$(PATH_INSTALL_DOC)\"" >>.config 227 @echo "#define PATH_INSTALL_LOCALE \"$(PATH_INSTALL_LOCALE)\"" >>.config 228 @echo "#define OPTION_THREADING $(OPTION_THREADING)" >>.config 229 @echo "#define OPTION_BIRTCFG $(OPTION_BIRTCFG)" >>.config 230 @echo "#define OPTION_POP $(OPTION_POP)" >>.config 231 @echo "#define OPTION_IMAP $(OPTION_IMAP)" >>.config 232 @echo "#define OPTION_SMTP $(OPTION_SMTP)" >>.config 233 @echo "#define CONFIG_MENUS $(CONFIG_MENUS)" >>.config 234 @echo "#define OPTION_TRAP $(OPTION_TRAP)" >>.config 235 @echo "#define OPTION_BUILTIN_DNS $(OPTION_BUILTIN_DNS)" >>.config 236 @echo "#define OPTION_EXECINT $(OPTION_EXECINT)" >>.config 237 @echo "#define OPTION_POLL $(OPTION_POLL)" >>.config 238 @echo "#define CONFIG_KEYMAPS $(CONFIG_KEYMAPS)" >>.config 239 @echo "#define CONFIG_LOCALDIR $(CONFIG_LOCALDIR)" >>.config 240 @echo "#define CONFIG_FTPDIR $(CONFIG_FTPDIR)" >>.config 241 @echo "#define CONFIG_RTCONFIG $(CONFIG_RTCONFIG)" >>.config 242 @echo "#define CONFIG_SESSIONS $(CONFIG_SESSIONS)" >>.config 243 @echo "#define CONFIG_JUMPS $(CONFIG_JUMPS)" >>.config 244 @echo "#define CONFIG_CONSOLE $(CONFIG_CONSOLE)" >>.config 245 @echo "#define CONFIG_HTTP $(CONFIG_HTTP)" >>.config 246 @echo "#define CONFIG_FTP $(CONFIG_FTP)" >>.config 247 @echo "#define CONFIG_FINGER $(CONFIG_FINGER)" >>.config 248 @echo "#define CONFIG_GOPHER $(CONFIG_GOPHER)" >>.config 249 @echo "#define CONFIG_ABOUT $(CONFIG_ABOUT)" >>.config 250 @echo "#define CONFIG_USER_QUERY $(CONFIG_USER_QUERY)" >>.config 251 @echo "#define CONFIG_BLOAT $(CONFIG_BLOAT)" >>.config 252 @echo "#define CONFIG_EXTRA $(CONFIG_EXTRA)" >>.config 253 @echo "#define CONFIG_WK $(CONFIG_WK)" >>.config 254 @echo "#define CONFIG_DISK_CACHE $(CONFIG_DISK_CACHE)" >>.config 255 @echo "#define CONFIG_HTML $(CONFIG_HTML)" >>.config 256 @echo "#define CONFIG_PLATFORM $(CONFIG_PLATFORM)" >>.config 257 @echo "#define CONFIG_JAVASCRIPT $(CONFIG_JAVASCRIPT)" >>.config 258 @echo "#define CONFIG_CSS $(CONFIG_CSS)" >>.config 259 @echo "#define CONFIG_DEBUG $(CONFIG_DEBUG)" >>.config 260 261retawqbin: $(OBJS) 262 tglibs=`tool/tgmode --libs $(OPTION_TG)`; $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(PTHREAD_LIBS) $$tglibs $(LTLS) $(LCLM) -o retawq 263 264stripsyms: 265 -strip --strip-unneeded retawq 266 267# In theory, users read documentation files without being told, at least when 268# something fails. But in practice, ... 269msgpre: 270 @echo "--- If this classical Makefile fails, use the configure script instead," 271 @echo "--- as described in the file INSTALL." 272 273msgpost: 274 @echo "Compilation seems to be successful." 275# @echo "(Don't care about any \"uninitialized\" warnings - they're wrong:-)" 276 @echo "Now try to start the program with \"./retawq\"." 277 278install: 279 rm -f $(PATH_INSTALL_BIN)/retawq 280 cp retawq $(PATH_INSTALL_BIN)/retawq-$(RETAWQ_VERSION) 281 cd $(PATH_INSTALL_BIN); ln -s retawq-$(RETAWQ_VERSION) retawq 282 cp docu/retawq.1 $(PATH_INSTALL_MAN)/man1/ 283 tool/instdocu $(PATH_INSTALL_DOC) 284ifeq ($(OPTION_I18N), 1) 285 -cp i18n/de.mo $(PATH_INSTALL_LOCALE)/de/LC_MESSAGES/retawq.mo 286 -cp i18n/es.mo $(PATH_INSTALL_LOCALE)/es/LC_MESSAGES/retawq.mo 287 -cp i18n/fr.mo $(PATH_INSTALL_LOCALE)/fr/LC_MESSAGES/retawq.mo 288 -cp i18n/ja.mo $(PATH_INSTALL_LOCALE)/ja/LC_MESSAGES/retawq.mo 289 -cp i18n/pt_BR.mo $(PATH_INSTALL_LOCALE)/pt_BR/LC_MESSAGES/retawq.mo 290endif 291 292report: config 293 -@echo "Please include the following information in all your bug and" 294 -@echo "problem reports:" 295 -@echo "(Beginning of report info)" 296 -@echo "retawq version: $(RETAWQ_VERSION)" 297 -@echo -n "Compiler: $(CC) " 298 -@$(CC) --version 299 -@echo "System:" 300 -@uname -m -s -r -v -p 301 -@echo "version of \"make\":" 302 -@make --version 303 -@echo "version of \"strip\":" 304 -@strip --version 305 -@echo "retawq configuration file (\".config\"):" 306 -@cat .config 307 -@echo "(End of report info)" 308 309clean: 310 rm -f .config tgmode.inc birtcfg.inc *.o retawq 311 312.PHONY: build_binary clean config devel install msgpost msgpre report retawqbin stripsyms 313