1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Automagically link in subdir lib.o files

It is a little ugly since I couldn't get $(wildcard) to expand *.o files
so it just checks if there are any *.c files and then link in the lib.o
based on that.
This commit is contained in:
Jonas Fonseca 2005-09-27 22:38:00 +02:00 committed by Jonas Fonseca
parent 888726e3b8
commit 68de9e35d3
13 changed files with 23 additions and 111 deletions

View File

@ -56,6 +56,15 @@ endif
>> .deps/$(*F).P; \ >> .deps/$(*F).P; \
rm .deps/$(*F).pp rm .deps/$(*F).pp
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)))
endif
ifneq ($(subobjs),)
OBJS += $(subobjs)
endif
ifdef OBJS ifdef OBJS
CLEAN += $(OBJS) CLEAN += $(OBJS)

View File

@ -3,32 +3,26 @@ include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_BOOKMARKS),yes) ifeq ($(CONFIG_BOOKMARKS),yes)
bookmarksdir = bookmarks bookmarksdir = bookmarks
bookmarkslib = $(bookmarksdir)/lib.o
endif endif
ifeq ($(CONFIG_COOKIES),yes) ifeq ($(CONFIG_COOKIES),yes)
cookiesdir = cookies cookiesdir = cookies
cookieslib = $(cookiesdir)/lib.o
endif endif
ifeq ($(CONFIG_FORMHIST),yes) ifeq ($(CONFIG_FORMHIST),yes)
formhistdir = formhist formhistdir = formhist
formhistlib = $(formhistdir)/lib.o
endif endif
ifeq ($(CONFIG_GLOBHIST),yes) ifeq ($(CONFIG_GLOBHIST),yes)
globhistdir = globhist globhistdir = globhist
globhistlib = $(globhistdir)/lib.o
endif endif
ifeq ($(CONFIG_ECMASCRIPT),yes) ifeq ($(CONFIG_ECMASCRIPT),yes)
ecmascriptdir = ecmascript ecmascriptdir = ecmascript
ecmascriptlib = $(ecmascriptdir)/lib.o
endif endif
ifeq ($(CONFIG_SCRIPTING),yes) ifeq ($(CONFIG_SCRIPTING),yes)
scriptingdir = scripting scriptingdir = scripting
scriptinglib = $(scriptingdir)/lib.o
endif endif
SUBDIRS = \ SUBDIRS = \
@ -55,49 +49,22 @@ SUBDIRS = \
util \ util \
viewer viewer
# Order of this is purely magic and random, so that ld doesn't fail for some
# strange reason. Try to swap randomly when ld will start to complain about
# mysteriously unresolved symbols.
ELINKSLIBS = \
main/lib.o \
$(cookieslib) \
viewer/lib.o \
cache/lib.o \
document/lib.o \
intl/lib.o \
session/lib.o \
network/lib.o \
terminal/lib.o \
$(scriptinglib) \
osdep/lib.o \
protocol/lib.o \
$(bookmarkslib) \
$(formhistlib) \
$(globhistlib) \
$(ecmascriptlib) \
config/lib.o \
dialogs/lib.o \
mime/lib.o \
bfu/lib.o \
encoding/lib.o \
intl/lib.o \
util/lib.o
# Get the GIT HEAD ID if possible # Get the GIT HEAD ID if possible
ifdef CG_COMMIT_ID ifdef CG_COMMIT_ID
BUILD_ID=$(shell $(CG_COMMIT_ID) 2> /dev/null) BUILD_ID=$(shell $(CG_COMMIT_ID) 2> /dev/null)
endif endif
INCLUDES += -DBUILD_ID="\"$(BUILD_ID)\"" INCLUDES += -DBUILD_ID="\"$(BUILD_ID)\""
OBJS = vernum.o $(ELINKSLIBS) OBJS = vernum.o
vernum.o: FORCE vernum.o: FORCE
FORCE: FORCE:
all-local: elinks all-local: elinks
elinks: $(OBJS) elinks: lib.o
$(call cmd,link) $(call cmd,link)
install-local: install-local:
$(INSTALL_PROGRAM) elinks $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) elinks $(DESTDIR)$(bindir)
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

@ -3,11 +3,6 @@ include $(path_to_top)/Makefile.config
SUBDIRS = backend SUBDIRS = backend
ifeq ($(CONFIG_XBEL_BOOKMARKS),yes) OBJS = bookmarks.o dialogs.o
xbelobj = xbel.o
endif
BACK_OBJS = common.o default.o $(xbelobj)
OBJS = bookmarks.o dialogs.o $(foreach obj,$(BACK_OBJS),backend/$(obj))
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

@ -3,26 +3,15 @@ include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_CSS),yes) ifeq ($(CONFIG_CSS),yes)
cssdir = css cssdir = css
cssobj = $(cssdir)/lib.o
endif endif
ifeq ($(CONFIG_DOM),yes) ifeq ($(CONFIG_DOM),yes)
domdir = dom domdir = dom
domobj = $(domdir)/lib.o
sgmldir = sgml sgmldir = sgml
sgmlobj = $(sgmldir)/lib.o
endif endif
SUBDIRS = $(cssdir) $(domdir) html plain $(sgmldir) SUBDIRS = $(cssdir) $(domdir) html plain $(sgmldir)
SUB_OBJS = \ OBJS = docdata.o document.o forms.o options.o refresh.o renderer.o
$(cssobj) \
$(domobj) \
html/lib.o \
plain/lib.o \
$(sgmlobj)
OBJS = docdata.o document.o forms.o options.o refresh.o renderer.o $(SUB_OBJS)
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

@ -3,6 +3,6 @@ include $(path_to_top)/Makefile.config
SUBDIRS = html SUBDIRS = html
OBJS = sgml.o parser.o scanner.o html/lib.o OBJS = sgml.o parser.o scanner.o
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

@ -4,7 +4,6 @@ INCLUDES += $(SPIDERMONKEY_CFLAGS)
SUBDIRS = spidermonkey SUBDIRS = spidermonkey
SM_OBJS = document.o form.o location.o navigator.o unibar.o window.o OBJS = ecmascript.o spidermonkey.o
OBJS = ecmascript.o spidermonkey.o spidermonkey/lib.o
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

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

View File

@ -5,7 +5,6 @@ SUBDIRS = backend
OBJS = \ OBJS = \
dialogs.o \ dialogs.o \
mime.o \ mime.o
backend/lib.o \
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

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

View File

@ -4,27 +4,22 @@ INCLUDES += $(X_CFLAGS)
ifeq ($(CONFIG_BEOS),yes) ifeq ($(CONFIG_BEOS),yes)
beosdir = beos beosdir = beos
beosobj = $(beosdir)/lib.o
endif endif
ifeq ($(CONFIG_OS2),yes) ifeq ($(CONFIG_OS2),yes)
os2dir = os2 os2dir = os2
os2obj = $(os2dir)/lib.o
endif endif
ifeq ($(CONFIG_RISCOS),yes) ifeq ($(CONFIG_RISCOS),yes)
riscosdir = riscos riscosdir = riscos
riscosobj = $(riscosdir)/lib.o
endif endif
ifeq ($(CONFIG_UNIX),yes) ifeq ($(CONFIG_UNIX),yes)
unixdir = unix unixdir = unix
unixobj = $(unixdir)/lib.o
endif endif
ifeq ($(CONFIG_WIN32),yes) ifeq ($(CONFIG_WIN32),yes)
win32dir = win32 win32dir = win32
win32obj = $(win32dir)/lib.o
endif endif
SUBDIRS = $(beosdir) $(os2dir) $(riscosdir) $(unixdir) $(win32dir) SUBDIRS = $(beosdir) $(os2dir) $(riscosdir) $(unixdir) $(win32dir)
@ -35,11 +30,6 @@ OBJS = \
osdep.o \ osdep.o \
signals.o \ signals.o \
stub.o \ stub.o \
sysname.o \ sysname.o
$(beosobj) \
$(os2obj) \
$(riscosobj) \
$(unixobj) \
$(win32obj)
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

@ -1,49 +1,36 @@
path_to_top=../.. path_to_top=../..
include $(path_to_top)/Makefile.config include $(path_to_top)/Makefile.config
authobj = auth/lib.o
ifeq ($(CONFIG_BITTORRENT),yes) ifeq ($(CONFIG_BITTORRENT),yes)
bittorrentdir = bittorrent bittorrentdir = bittorrent
bittorrentobj = $(bittorrentdir)/lib.o
endif endif
ifeq ($(CONFIG_DATA),yes) ifeq ($(CONFIG_DATA),yes)
dataobj = data.o dataobj = data.o
endif endif
fileobj = file/lib.o
ifeq ($(CONFIG_FINGER),yes) ifeq ($(CONFIG_FINGER),yes)
fingerdir = finger fingerdir = finger
fingerobj = $(fingerdir)/lib.o
endif endif
ifeq ($(CONFIG_FTP),yes) ifeq ($(CONFIG_FTP),yes)
ftpdir = ftp ftpdir = ftp
ftpobj = $(ftpdir)/lib.o
endif endif
ifeq ($(CONFIG_GOPHER),yes) ifeq ($(CONFIG_GOPHER),yes)
gopherdir = gopher gopherdir = gopher
gopherobj = $(gopherdir)/lib.o
endif endif
httpobj = http/lib.o
ifeq ($(CONFIG_NNTP),yes) ifeq ($(CONFIG_NNTP),yes)
nntpdir = nntp nntpdir = nntp
nntpobj = $(nntpdir)/lib.o
endif endif
ifeq ($(CONFIG_SMB),yes) ifeq ($(CONFIG_SMB),yes)
smbdir = smb smbdir = smb
smbobj = $(smbdir)/lib.o
endif endif
ifeq ($(CONFIG_URI_REWRITE),yes) ifeq ($(CONFIG_URI_REWRITE),yes)
rewritedir = rewrite rewritedir = rewrite
rewriteobj = $(rewritedir)/lib.o
endif endif
SUBDIRS = \ SUBDIRS = \
@ -58,20 +45,6 @@ SUBDIRS = \
$(rewritedir) \ $(rewritedir) \
$(smbdir) $(smbdir)
SUB_OBJS = \ OBJS = about.o $(dataobj) date.o header.o protocol.o proxy.o uri.o user.o
$(authobj) \
$(bittorrentobj) \
$(dataobj) \
$(cgiobj) \
$(fileobj) \
$(fingerobj) \
$(ftpobj) \
$(gopherobj) \
$(httpobj) \
$(nntpobj) \
$(rewriteobj) \
$(smbobj)
OBJS = about.o date.o header.o protocol.o proxy.o uri.o user.o $(SUB_OBJS)
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

@ -3,31 +3,26 @@ include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_GUILE),yes) ifeq ($(CONFIG_GUILE),yes)
guiledir = guile guiledir = guile
guileobj = $(guiledir)/lib.o
endif endif
ifeq ($(CONFIG_LUA),yes) ifeq ($(CONFIG_LUA),yes)
luadir = lua luadir = lua
luaobj = $(luadir)/lib.o
endif endif
ifeq ($(CONFIG_PERL),yes) ifeq ($(CONFIG_PERL),yes)
perldir = perl perldir = perl
perlobj = $(perldir)/lib.o
endif endif
ifeq ($(CONFIG_PYTHON),yes) ifeq ($(CONFIG_PYTHON),yes)
pythondir = python pythondir = python
pythonobj = $(pythondir)/lib.o
endif endif
ifeq ($(CONFIG_RUBY),yes) ifeq ($(CONFIG_RUBY),yes)
rubydir = ruby rubydir = ruby
rubyobj = $(rubydir)/lib.o
endif endif
SUBDIRS = $(guiledir) $(luadir) $(perldir) $(pythondir) $(rubydir) SUBDIRS = $(guiledir) $(luadir) $(perldir) $(pythondir) $(rubydir)
OBJS = scripting.o $(guileobj) $(luaobj) $(perlobj) $(pythonobj) $(rubyobj) OBJS = scripting.o
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib

View File

@ -5,8 +5,6 @@ SUBDIRS = dump text
OBJS = \ OBJS = \
action.o \ action.o \
timer.o \ timer.o
dump/lib.o \
text/lib.o
include $(path_to_top)/Makefile.lib include $(path_to_top)/Makefile.lib