# retawq/Makefile - classical-style Makefile
# This file is part of retawq (), a network
# client created by Arne Thomassen; retawq is basically released under certain
# versions of the GNU General Public License and WITHOUT ANY WARRANTY.
# Read the file COPYING for license details, README for program information.
# Copyright (C) 2001-2005 Arne Thomassen
# Part A. You might want to change the following settings;
# see retawq/docu/ctconfig.html for documentation.
# text/graphics mode (curses, ncurses, bicurses, xcurses, ...)
OPTION_TG = ncurses
# text-mode mouse
OPTION_TEXTMODEMOUSE = 1
# i18n (internationalization)
OPTION_I18N = 0
# quality of character entity display
OPTION_CED = 1
# HTTP cookies
OPTION_COOKIES = 1
# News/NNTP schemes
OPTION_NEWS = 1
# local CGI scheme
OPTION_LOCAL_CGI = 0
# whether external programs (besides any local CGI scripts) may be executed
OPTION_EXECEXT = 0
# TLS/SSL (0=disabled, 1=GnuTLS, 2=OpenSSL)
OPTION_TLS = 0
# IPv6 support
OPTION_IPV6 = 0
# threading: 0 means none (DNS hostname lookups will "block" the whole
# program so that it will seem to hang), 1 means OS-independent pthreads
# library, 2 means Linux-specific clone() syscall
OPTION_THREADING = 1
# whether a built-in run-time configuration file shall be used
OPTION_BIRTCFG = 0
# paths for "make install"; don't add a trailing "/"!
PATH_INSTALL_PREFIX = /usr/local
PATH_INSTALL_BIN = $(PATH_INSTALL_PREFIX)/bin
PATH_INSTALL_MAN = $(PATH_INSTALL_PREFIX)/man
PATH_INSTALL_DOC = $(PATH_INSTALL_PREFIX)/doc/retawq
PATH_INSTALL_LOCALE = $(PATH_INSTALL_PREFIX)/share/locale
# put your favourite C compiler here; mine is "gcc"
CC = gcc
# compiler flags; "-O2" is the code optimization level for gcc
ifeq ($(CC), gcc)
CFLAGS = -O2
else
CFLAGS =
endif
# flags for multi-threading
ifeq ($(OPTION_THREADING), 0)
# nothing
else
CFLAGS += -D_REENTRANT -D_THREAD_SAFE
endif
# Part B. Don't change any of the following!
# e-mail protocols
OPTION_POP = 0
OPTION_IMAP = 0
OPTION_SMTP = 0
# other stuff
OPTION_TRAP = 0
OPTION_BUILTIN_DNS = 0
OPTION_EXECINT = 0
OPTION_POLL = 0
CONFIG_MENUS = 32767
CONFIG_KEYMAPS = 1
CONFIG_LOCALDIR = 2
CONFIG_FTPDIR = 1
CONFIG_RTCONFIG = 1
CONFIG_SESSIONS = 1
CONFIG_JUMPS = 1
CONFIG_CONSOLE = 1
CONFIG_HTTP = 32767
CONFIG_FTP = 1
CONFIG_FINGER = 1
CONFIG_GOPHER = 0
CONFIG_ABOUT = 32767
CONFIG_USER_QUERY = 1
CONFIG_BLOAT = 32767
CONFIG_EXTRA = 32767
CONFIG_WK = 32767
CONFIG_DISK_CACHE = 0
CONFIG_HTML = 32767
CONFIG_PLATFORM = 0
CONFIG_JAVASCRIPT = 0
CONFIG_CSS = 0
CONFIG_DEBUG = 0
# enable useful warnings for gcc
# CHECKME: re-enable "-Wtraditional" as soon as the dumb warning flood for the
# MD5 algorithm constants can be stopped somehow
ifeq ($(CONFIG_DEBUG), 1)
ifeq ($(CC), gcc)
CFLAGS += -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
endif
endif
# object files
OBJS = main.o resource.o parser.o init.o stuff.o $(shell tool/tgmode --objs $(OPTION_TG))
# handle TLS
ifeq ($(OPTION_TLS), 0)
LTLS =
else
CFLAGS += $(shell tool/tlsmode --cflags $(OPTION_TLS))
LTLS = $(shell tool/tlsmode --libs $(OPTION_TLS))
endif
ifeq ($(CONFIG_JAVASCRIPT), 1)
OBJS += javascript.o
LCLM = -lm
else
LCLM =
endif
ifeq ($(OPTION_THREADING), 1)
PTHREAD_LIBS = -lpthread
else
PTHREAD_LIBS =
endif
RETAWQ_VERSION = 0.2.6b
build_binary: msgpre clean config retawqbin stripsyms msgpost
devel: clean config retawqbin
config:
@tool/tgmode --init $(OPTION_TG) || { (exit 1); exit 1; }
@echo "/* Auto-generated by retawq/Makefile, do not edit */" >.config
@echo "#define USING_CONFIGURE 0" >>.config
# configure script simulation...
@echo "#define STDC_HEADERS 1" >>.config
@echo "#define HAVE_BCOPY 1" >>.config
@echo "#define HAVE_BZERO 1" >>.config
@echo "#define HAVE_CURSES_RESIZETERM 1" >>.config
@echo "#define HAVE_DUP2 1" >>.config
@echo "#define HAVE_GETADDRINFO 1" >>.config
@echo "#define HAVE_GETCWD 1" >>.config
@echo "#define HAVE_GETNAMEINFO 1" >>.config
@echo "#define HAVE_GETIPNODEBYNAME 0" >>.config
@echo "#define HAVE_GETTIMEOFDAY 1" >>.config
@echo "#define HAVE_INET_ADDR 1" >>.config
@echo "#define HAVE_INET_NTOP 1" >>.config
@echo "#define HAVE_INET_PTON 1" >>.config
@echo "#define HAVE_MEMCPY 1" >>.config
@echo "#define HAVE_MEMSET 1" >>.config
@echo "#define HAVE_MMAP 1" >>.config
@echo "#define HAVE_PUTENV 1" >>.config
@echo "#define HAVE_SETENV 1" >>.config
@echo "#define HAVE_SIGACTION 1" >>.config
@echo "#define HAVE_SIGDELSET 1" >>.config
@echo "#define HAVE_SIGFILLSET 1" >>.config
@echo "#define HAVE_SIGPROCMASK 1" >>.config
@echo "#define HAVE_STRCASECMP 1" >>.config
@echo "#define HAVE_STRNCASECMP 1" >>.config
@echo "#define HAVE_STRCHR 1" >>.config
@echo "#define HAVE_STRERROR 1" >>.config
@echo "#define HAVE_STRRCHR 1" >>.config
@echo "#define HAVE_STRSTR 1" >>.config
@echo "#define HAVE_UNAME 1" >>.config
@echo "#define HAVE_WAIT3 0" >>.config
@echo "#define HAVE_WAITPID 1" >>.config
@echo "#define HAVE_ARPA_INET_H 1" >>.config
@echo "#define HAVE_DIRENT_H 1" >>.config
@echo "#define HAVE_ERRNO_H 1" >>.config
@echo "#define HAVE_FCNTL_H 1" >>.config
@echo "#define HAVE_LIBINTL_H 1" >>.config
@echo "#define HAVE_LIMITS_H 1" >>.config
@echo "#define HAVE_MEMORY_H 1" >>.config
@echo "#define HAVE_NDIR_H 1" >>.config
@echo "#define HAVE_NETDB_H 1" >>.config
@echo "#define HAVE_NETINET_IN_H 1" >>.config
@echo "#define HAVE_STDARG_H 1" >>.config
# @echo "#define HAVE_STDINT_H 1" >>.config
@echo "#define HAVE_STDLIB_H 1" >>.config
@echo "#define HAVE_STRINGS_H 1" >>.config
@echo "#define HAVE_STRING_H 1" >>.config
@echo "#define HAVE_SYS_DIR_H 1" >>.config
@echo "#define HAVE_SYS_IOCTL_H 1" >>.config
@echo "#define HAVE_SYS_NDIR_H 1" >>.config
@echo "#define HAVE_SYS_POLL_H 1" >>.config
@echo "#define HAVE_SYS_SELECT_H 1" >>.config
@echo "#define HAVE_SYS_SOCKET_H 1" >>.config
@echo "#define HAVE_SYS_STAT_H 1" >>.config
@echo "#define HAVE_SYS_TIME_H 1" >>.config
@echo "#define HAVE_SYS_TYPES_H 1" >>.config
@echo "#define HAVE_SYS_WAIT_H 1" >>.config
@echo "#define HAVE_TERMIOS_H 1" >>.config
@echo "#define HAVE_UNISTD_H 1" >>.config
@echo "#define HAVE_VARARGS_H 0" >>.config
# ...and the real stuff
@echo "#define RETAWQ_VERSION \"$(RETAWQ_VERSION)\"" >>.config
@echo "#define OPTION_TG $(OPTION_TG)" >>.config # just to see...
@echo "#define CONFIG_TG `tool/tgmode --cftg $(OPTION_TG)`" >>.config
@echo "#define OPTION_TEXTMODEMOUSE $(OPTION_TEXTMODEMOUSE)" >>.config
@echo "#define OPTION_CED $(OPTION_CED)" >>.config
@echo "#define OPTION_COOKIES $(OPTION_COOKIES)" >>.config
@echo "#define OPTION_LOCAL_CGI $(OPTION_LOCAL_CGI)" >>.config
@echo "#define OPTION_EXECEXT $(OPTION_EXECEXT)" >>.config
@echo "#define OPTION_TLS $(OPTION_TLS)" >>.config
@echo "#define OPTION_IPV6 $(OPTION_IPV6)" >>.config
@echo "#define OPTION_I18N $(OPTION_I18N)" >>.config
@echo "#define OPTION_NEWS $(OPTION_NEWS)" >>.config
@echo "#define PATH_INSTALL_DOC \"$(PATH_INSTALL_DOC)\"" >>.config
@echo "#define PATH_INSTALL_LOCALE \"$(PATH_INSTALL_LOCALE)\"" >>.config
@echo "#define OPTION_THREADING $(OPTION_THREADING)" >>.config
@echo "#define OPTION_BIRTCFG $(OPTION_BIRTCFG)" >>.config
@echo "#define OPTION_POP $(OPTION_POP)" >>.config
@echo "#define OPTION_IMAP $(OPTION_IMAP)" >>.config
@echo "#define OPTION_SMTP $(OPTION_SMTP)" >>.config
@echo "#define CONFIG_MENUS $(CONFIG_MENUS)" >>.config
@echo "#define OPTION_TRAP $(OPTION_TRAP)" >>.config
@echo "#define OPTION_BUILTIN_DNS $(OPTION_BUILTIN_DNS)" >>.config
@echo "#define OPTION_EXECINT $(OPTION_EXECINT)" >>.config
@echo "#define OPTION_POLL $(OPTION_POLL)" >>.config
@echo "#define CONFIG_KEYMAPS $(CONFIG_KEYMAPS)" >>.config
@echo "#define CONFIG_LOCALDIR $(CONFIG_LOCALDIR)" >>.config
@echo "#define CONFIG_FTPDIR $(CONFIG_FTPDIR)" >>.config
@echo "#define CONFIG_RTCONFIG $(CONFIG_RTCONFIG)" >>.config
@echo "#define CONFIG_SESSIONS $(CONFIG_SESSIONS)" >>.config
@echo "#define CONFIG_JUMPS $(CONFIG_JUMPS)" >>.config
@echo "#define CONFIG_CONSOLE $(CONFIG_CONSOLE)" >>.config
@echo "#define CONFIG_HTTP $(CONFIG_HTTP)" >>.config
@echo "#define CONFIG_FTP $(CONFIG_FTP)" >>.config
@echo "#define CONFIG_FINGER $(CONFIG_FINGER)" >>.config
@echo "#define CONFIG_GOPHER $(CONFIG_GOPHER)" >>.config
@echo "#define CONFIG_ABOUT $(CONFIG_ABOUT)" >>.config
@echo "#define CONFIG_USER_QUERY $(CONFIG_USER_QUERY)" >>.config
@echo "#define CONFIG_BLOAT $(CONFIG_BLOAT)" >>.config
@echo "#define CONFIG_EXTRA $(CONFIG_EXTRA)" >>.config
@echo "#define CONFIG_WK $(CONFIG_WK)" >>.config
@echo "#define CONFIG_DISK_CACHE $(CONFIG_DISK_CACHE)" >>.config
@echo "#define CONFIG_HTML $(CONFIG_HTML)" >>.config
@echo "#define CONFIG_PLATFORM $(CONFIG_PLATFORM)" >>.config
@echo "#define CONFIG_JAVASCRIPT $(CONFIG_JAVASCRIPT)" >>.config
@echo "#define CONFIG_CSS $(CONFIG_CSS)" >>.config
@echo "#define CONFIG_DEBUG $(CONFIG_DEBUG)" >>.config
retawqbin: $(OBJS)
tglibs=`tool/tgmode --libs $(OPTION_TG)`; $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(PTHREAD_LIBS) $$tglibs $(LTLS) $(LCLM) -o retawq
stripsyms:
-strip --strip-unneeded retawq
# In theory, users read documentation files without being told, at least when
# something fails. But in practice, ...
msgpre:
@echo "--- If this classical Makefile fails, use the configure script instead,"
@echo "--- as described in the file INSTALL."
msgpost:
@echo "Compilation seems to be successful."
# @echo "(Don't care about any \"uninitialized\" warnings - they're wrong:-)"
@echo "Now try to start the program with \"./retawq\"."
install:
rm -f $(PATH_INSTALL_BIN)/retawq
cp retawq $(PATH_INSTALL_BIN)/retawq-$(RETAWQ_VERSION)
cd $(PATH_INSTALL_BIN); ln -s retawq-$(RETAWQ_VERSION) retawq
cp docu/retawq.1 $(PATH_INSTALL_MAN)/man1/
tool/instdocu $(PATH_INSTALL_DOC)
ifeq ($(OPTION_I18N), 1)
-cp i18n/de.mo $(PATH_INSTALL_LOCALE)/de/LC_MESSAGES/retawq.mo
-cp i18n/es.mo $(PATH_INSTALL_LOCALE)/es/LC_MESSAGES/retawq.mo
-cp i18n/fr.mo $(PATH_INSTALL_LOCALE)/fr/LC_MESSAGES/retawq.mo
-cp i18n/pt_BR.mo $(PATH_INSTALL_LOCALE)/pt_BR/LC_MESSAGES/retawq.mo
endif
report: config
-@echo "Please include the following information in all your bug and"
-@echo "problem reports:"
-@echo "(Beginning of report info)"
-@echo "retawq version: $(RETAWQ_VERSION)"
-@echo -n "Compiler: $(CC) "
-@$(CC) --version
-@echo "System:"
-@uname -m -s -r -v -p
-@echo "version of \"make\":"
-@make --version
-@echo "version of \"strip\":"
-@strip --version
-@echo "retawq configuration file (\".config\"):"
-@cat .config
-@echo "(End of report info)"
clean:
rm -f .config tgmode.inc birtcfg.inc *.o retawq
.PHONY: build_binary clean config devel install msgpost msgpre report retawqbin stripsyms