1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-20 00:15:31 +00:00

Simplify the conditional building

Use the very cool 'VAR-$(CONFIG_FOO) += foo.o' feature instead of the more
verbose current ifeq($(CONFIG_FOO),yes) wrapping.
This commit is contained in:
Jonas Fonseca 2005-09-27 22:49:47 +02:00 committed by Jonas Fonseca
parent 68de9e35d3
commit c76586e6b8
8 changed files with 41 additions and 134 deletions

View File

@ -56,10 +56,18 @@ endif
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
ifdef SUBDIRS-yes
SUBDIRS += $(SUBDIRS-yes)
endif
ifdef OBJS-yes
OBJS += $(OBJS-yes)
endif
ifdef SUBDIRS
# Apparently wildcard won't expand *.o files so check if there are any *.c
# files and use that to magically add the lib.o file of the subdirectory.
subobjs := $(strip $(foreach subdir,$(SUBDIRS),$(if $(wildcard $(subdir)/*.c),$(subdir)/lib.o)))
subobjs := $(strip $(foreach subdir,$(sort $(SUBDIRS)),$(if $(wildcard $(subdir)/*.c),$(subdir)/lib.o)))
endif
ifneq ($(subobjs),)
OBJS += $(subobjs)
@ -71,7 +79,7 @@ CLEAN += $(OBJS)
clean-local:
$(RM) lib.o $(CLEAN)
lib.o: $(OBJS)
lib.o: $(sort $(OBJS))
$(call cmd,ld_objs)
all-local: lib.o
@ -84,7 +92,7 @@ endif
all-recursive install-recursive clean-recursive:
ifdef SUBDIRS
@target=`echo $@ | sed s/-recursive//`; \
for subdir in $(SUBDIRS); do \
for subdir in $(sort $(SUBDIRS)); do \
$(call ncmd,recmake) || exit 1; \
done
endif

View File

@ -1,49 +1,26 @@
path_to_top=..
include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_BOOKMARKS),yes)
bookmarksdir = bookmarks
endif
ifeq ($(CONFIG_COOKIES),yes)
cookiesdir = cookies
endif
ifeq ($(CONFIG_FORMHIST),yes)
formhistdir = formhist
endif
ifeq ($(CONFIG_GLOBHIST),yes)
globhistdir = globhist
endif
ifeq ($(CONFIG_ECMASCRIPT),yes)
ecmascriptdir = ecmascript
endif
ifeq ($(CONFIG_SCRIPTING),yes)
scriptingdir = scripting
endif
SUBDIRS-$(CONFIG_BOOKMARKS) += bookmarks
SUBDIRS-$(CONFIG_COOKIES) += cookies
SUBDIRS-$(CONFIG_FORMHIST) += formhist
SUBDIRS-$(CONFIG_GLOBHIST) += globhist
SUBDIRS-$(CONFIG_ECMASCRIPT) += ecmascript
SUBDIRS-$(CONFIG_SCRIPTING) += scripting
SUBDIRS = \
bfu \
$(bookmarksdir) \
cache \
config \
$(cookiesdir) \
dialogs \
document \
$(ecmascriptdir) \
encoding \
$(formhistdir) \
$(globhistdir) \
intl \
main \
mime \
network \
osdep \
protocol \
$(scriptingdir) \
session \
terminal \
util \

View File

@ -1,16 +1,10 @@
path_to_top=../..
include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_CSS),yes)
cssdir = css
endif
SUBDIRS-$(CONFIG_CSS) += css
SUBDIRS-$(CONFIG_DOM) += dom sgml
ifeq ($(CONFIG_DOM),yes)
domdir = dom
sgmldir = sgml
endif
SUBDIRS = $(cssdir) $(domdir) html plain $(sgmldir)
SUBDIRS = html plain
OBJS = docdata.o document.o forms.o options.o refresh.o renderer.o

View File

@ -1,11 +1,7 @@
path_to_top=../..
include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_NLS),yes)
gettextdir = gettext
endif
SUBDIRS = $(gettextdir)
SUBDIRS-$(CONFIG_NLS) += gettext
OBJS = charsets.o

View File

@ -1,11 +1,7 @@
path_to_top=../..
include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_SSL),yes)
ssldir = ssl
endif
SUBDIRS = $(ssldir)
SUBDIRS-$(CONFIG_SSL) += ssl
OBJS = connection.o dns.o progress.o socket.o state.o

View File

@ -2,27 +2,11 @@ path_to_top=../..
include $(path_to_top)/Makefile.config
INCLUDES += $(X_CFLAGS)
ifeq ($(CONFIG_BEOS),yes)
beosdir = beos
endif
ifeq ($(CONFIG_OS2),yes)
os2dir = os2
endif
ifeq ($(CONFIG_RISCOS),yes)
riscosdir = riscos
endif
ifeq ($(CONFIG_UNIX),yes)
unixdir = unix
endif
ifeq ($(CONFIG_WIN32),yes)
win32dir = win32
endif
SUBDIRS = $(beosdir) $(os2dir) $(riscosdir) $(unixdir) $(win32dir)
SUBDIRS-$(CONFIG_BEOS) += beos
SUBDIRS-$(CONFIG_OS2) += os2
SUBDIRS-$(CONFIG_RISCOS) += riscos
SUBDIRS-$(CONFIG_UNIX) += unix
SUBDIRS-$(CONFIG_WIN32) += win32
OBJS = \
getifaddrs.o \

View File

@ -1,49 +1,17 @@
path_to_top=../..
include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_BITTORRENT),yes)
bittorrentdir = bittorrent
endif
SUBDIRS-$(CONFIG_BITTORRENT) += bittorrent
SUBDIRS-$(CONFIG_FINGER) += finger
SUBDIRS-$(CONFIG_FTP) += ftp
SUBDIRS-$(CONFIG_GOPHER) += gopher
SUBDIRS-$(CONFIG_NNTP) += nntp
SUBDIRS-$(CONFIG_SMB) += smb
SUBDIRS-$(CONFIG_URI_REWRITE) += rewrite
ifeq ($(CONFIG_DATA),yes)
dataobj = data.o
endif
OBJS-$(CONFIG_DATA) += data.o
ifeq ($(CONFIG_FINGER),yes)
fingerdir = finger
endif
ifeq ($(CONFIG_FTP),yes)
ftpdir = ftp
endif
ifeq ($(CONFIG_GOPHER),yes)
gopherdir = gopher
endif
ifeq ($(CONFIG_NNTP),yes)
nntpdir = nntp
endif
ifeq ($(CONFIG_SMB),yes)
smbdir = smb
endif
ifeq ($(CONFIG_URI_REWRITE),yes)
rewritedir = rewrite
endif
SUBDIRS = \
auth \
$(bittorrentdir) \
file \
$(fingerdir) \
$(ftpdir) \
$(gopherdir) \
http \
$(nntpdir) \
$(rewritedir) \
$(smbdir)
SUBDIRS = auth file http
OBJS = about.o $(dataobj) date.o header.o protocol.o proxy.o uri.o user.o

View File

@ -1,27 +1,11 @@
path_to_top=../..
include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_GUILE),yes)
guiledir = guile
endif
ifeq ($(CONFIG_LUA),yes)
luadir = lua
endif
ifeq ($(CONFIG_PERL),yes)
perldir = perl
endif
ifeq ($(CONFIG_PYTHON),yes)
pythondir = python
endif
ifeq ($(CONFIG_RUBY),yes)
rubydir = ruby
endif
SUBDIRS = $(guiledir) $(luadir) $(perldir) $(pythondir) $(rubydir)
SUBDIRS-$(CONFIG_GUILE) += guile
SUBDIRS-$(CONFIG_LUA) += lua
SUBDIRS-$(CONFIG_PERL) += perl
SUBDIRS-$(CONFIG_PYTHON) += python
SUBDIRS-$(CONFIG_RUBY) += ruby
OBJS = scripting.o