diff --git a/Makefile.lib b/Makefile.lib index baf96444..22fa09c1 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -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 diff --git a/src/Makefile b/src/Makefile index f9aa5d19..8d7f7bb8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 \ diff --git a/src/document/Makefile b/src/document/Makefile index 01ac9724..b3132545 100644 --- a/src/document/Makefile +++ b/src/document/Makefile @@ -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 diff --git a/src/intl/Makefile b/src/intl/Makefile index 8e4cc998..a092bd65 100644 --- a/src/intl/Makefile +++ b/src/intl/Makefile @@ -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 diff --git a/src/network/Makefile b/src/network/Makefile index 68280af5..48eb6cc8 100644 --- a/src/network/Makefile +++ b/src/network/Makefile @@ -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 diff --git a/src/osdep/Makefile b/src/osdep/Makefile index 75176c76..829bff9f 100644 --- a/src/osdep/Makefile +++ b/src/osdep/Makefile @@ -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 \ diff --git a/src/protocol/Makefile b/src/protocol/Makefile index 0a1588aa..f47d7497 100644 --- a/src/protocol/Makefile +++ b/src/protocol/Makefile @@ -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 diff --git a/src/scripting/Makefile b/src/scripting/Makefile index 8386366a..2fb43004 100644 --- a/src/scripting/Makefile +++ b/src/scripting/Makefile @@ -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