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; \
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
CLEAN += $(OBJS)

View File

@ -3,32 +3,26 @@ include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_BOOKMARKS),yes)
bookmarksdir = bookmarks
bookmarkslib = $(bookmarksdir)/lib.o
endif
ifeq ($(CONFIG_COOKIES),yes)
cookiesdir = cookies
cookieslib = $(cookiesdir)/lib.o
endif
ifeq ($(CONFIG_FORMHIST),yes)
formhistdir = formhist
formhistlib = $(formhistdir)/lib.o
endif
ifeq ($(CONFIG_GLOBHIST),yes)
globhistdir = globhist
globhistlib = $(globhistdir)/lib.o
endif
ifeq ($(CONFIG_ECMASCRIPT),yes)
ecmascriptdir = ecmascript
ecmascriptlib = $(ecmascriptdir)/lib.o
endif
ifeq ($(CONFIG_SCRIPTING),yes)
scriptingdir = scripting
scriptinglib = $(scriptingdir)/lib.o
endif
SUBDIRS = \
@ -55,49 +49,22 @@ SUBDIRS = \
util \
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
ifdef CG_COMMIT_ID
BUILD_ID=$(shell $(CG_COMMIT_ID) 2> /dev/null)
endif
INCLUDES += -DBUILD_ID="\"$(BUILD_ID)\""
OBJS = vernum.o $(ELINKSLIBS)
OBJS = vernum.o
vernum.o: FORCE
FORCE:
all-local: elinks
elinks: $(OBJS)
elinks: lib.o
$(call cmd,link)
install-local:
$(INSTALL_PROGRAM) elinks $(DESTDIR)$(bindir)
include $(path_to_top)/Makefile.lib

View File

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

View File

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

View File

@ -3,6 +3,6 @@ include $(path_to_top)/Makefile.config
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

View File

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

View File

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

View File

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

View File

@ -3,11 +3,10 @@ include $(path_to_top)/Makefile.config
ifeq ($(CONFIG_SSL),yes)
ssldir = ssl
sslobj = $(ssldir)/lib.o
endif
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

View File

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

View File

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

View File

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

View File

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