My company has a miniature POSIX-wannabe OS thing, which we’ve been putting on embedded devices to track various little things (IC cards, etc.)
I’m trying to get it where we can store multiple customer-specific packages in the kernel source base, each with it’s own folder and a shell script to add some “magic” files that will cause that customer’s bit, and no others, to be compiled in with the kernel (yes, it has to be compiled into the kernel.) But I’m running into a problem with linking in libraries.
In the toplevel Makefile, we have a variable:
LIBS := $(TOPDIR)/applets/lib/libapplets.a
which then is fed to the big linking command further down:
$(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o init/setup.o \
--start-group $(BEGINWHOLEARCHIVE) \
$(CORE_FILES) \
$(DRIVERS) \
$(FS) \
$(NETWORKS) \
$(VIDEOS) \
$(SOUNDS) \
$(INPUTS) \
$(APPLETS) $(ENDWHOLEARCHIVE) \
$(LIBS) \
--end-group \
-o $(project)
I’ve tried export to allow my sub-Makefile to be able to access the LIBS variable so I can add my customer specific one to it, but to no effect. I.e.:
LIBS += $(TOP_DIR)/customerA/libs/libA.a #This isn’t working
The full method I am using is to have two Makefiles in my customer folder, a real Makefile and a MagicMakefile. The install script copies the MagicMakefile up a directory where the Makefile always looks for it.
-include MagicMakefile
MagicMakefile simple does an include to the real Makefile.
include custumerA/Makefile
It is from the real Makefile that I would like to be able to access LIBS or otherwise be able to finagle a way to get my .a file added into the link list dependent on the contents of customerA/Makefile. The make sequence runs through without error, simply the top-level LIBS never is affected by the sub-level addition.
Anyone know where I’m going wrong?