1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04: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; \ >> .deps/$(*F).P; \
rm .deps/$(*F).pp rm .deps/$(*F).pp
ifdef SUBDIRS-yes
SUBDIRS += $(SUBDIRS-yes)
endif
ifdef OBJS-yes
OBJS += $(OBJS-yes)
endif
ifdef SUBDIRS ifdef SUBDIRS
# Apparently wildcard won't expand *.o files so check if there are any *.c # 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. # 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 endif
ifneq ($(subobjs),) ifneq ($(subobjs),)
OBJS += $(subobjs) OBJS += $(subobjs)
@ -71,7 +79,7 @@ CLEAN += $(OBJS)
clean-local: clean-local:
$(RM) lib.o $(CLEAN) $(RM) lib.o $(CLEAN)
lib.o: $(OBJS) lib.o: $(sort $(OBJS))
$(call cmd,ld_objs) $(call cmd,ld_objs)
all-local: lib.o all-local: lib.o
@ -84,7 +92,7 @@ endif
all-recursive install-recursive clean-recursive: all-recursive install-recursive clean-recursive:
ifdef SUBDIRS ifdef SUBDIRS
@target=`echo $@ | sed s/-recursive//`; \ @target=`echo $@ | sed s/-recursive//`; \
for subdir in $(SUBDIRS); do \ for subdir in $(sort $(SUBDIRS)); do \
$(call ncmd,recmake) || exit 1; \ $(call ncmd,recmake) || exit 1; \
done done
endif endif

View File

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

View File

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

View File

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

View File

@ -1,11 +1,7 @@
path_to_top=../.. path_to_top=../..
include $(path_to_top)/Makefile.config include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_SSL),yes) SUBDIRS-$(CONFIG_SSL) += ssl
ssldir = ssl
endif
SUBDIRS = $(ssldir)
OBJS = connection.o dns.o progress.o socket.o state.o 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 include $(path_to_top)/Makefile.config
INCLUDES += $(X_CFLAGS) INCLUDES += $(X_CFLAGS)
ifeq ($(CONFIG_BEOS),yes) SUBDIRS-$(CONFIG_BEOS) += beos
beosdir = beos SUBDIRS-$(CONFIG_OS2) += os2
endif SUBDIRS-$(CONFIG_RISCOS) += riscos
SUBDIRS-$(CONFIG_UNIX) += unix
ifeq ($(CONFIG_OS2),yes) SUBDIRS-$(CONFIG_WIN32) += win32
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)
OBJS = \ OBJS = \
getifaddrs.o \ getifaddrs.o \

View File

@ -1,49 +1,17 @@
path_to_top=../.. path_to_top=../..
include $(path_to_top)/Makefile.config include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_BITTORRENT),yes) SUBDIRS-$(CONFIG_BITTORRENT) += bittorrent
bittorrentdir = bittorrent SUBDIRS-$(CONFIG_FINGER) += finger
endif 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) OBJS-$(CONFIG_DATA) += data.o
dataobj = data.o
endif
ifeq ($(CONFIG_FINGER),yes) SUBDIRS = auth file http
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)
OBJS = about.o $(dataobj) date.o header.o protocol.o proxy.o uri.o user.o 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=../.. path_to_top=../..
include $(path_to_top)/Makefile.config include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_GUILE),yes) SUBDIRS-$(CONFIG_GUILE) += guile
guiledir = guile SUBDIRS-$(CONFIG_LUA) += lua
endif SUBDIRS-$(CONFIG_PERL) += perl
SUBDIRS-$(CONFIG_PYTHON) += python
ifeq ($(CONFIG_LUA),yes) SUBDIRS-$(CONFIG_RUBY) += ruby
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)
OBJS = scripting.o OBJS = scripting.o