[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNUmakefile
From: |
Nicola Pero |
Subject: |
Re: GNUmakefile |
Date: |
Wed, 25 Feb 2009 10:30:49 +0100 |
On 24 Feb 2009, at 23:44, Julien Isorce wrote:
Thx a lot that works.
I have source1, source2, source2/source3
so I did mylib_SUBPROJECTS = source1 source2 source2/source3
The result is mylib-0.dll and libmylib.dll.a
Do you know have to have libmylib.dll instead of mylib-0.dll ?
(I read in the manual that I have to prefix by "lib" but I think I
did it: LIBRARY_NAME = libmylib)
Well, it should all work with mylib-0.dll and libmylib.dll.a. They
are expected. You can link the library using -lmylib.
The version number (the '0') matters though; your executable will
require mylib-0.dll and won't work for example
with mylib-1.dll. ;-)
The way the 'lib' prefix and the version number are added is
automatic. The 'lib' prefix gets automatically
added on Unix, and stripped on Windows. You can link the library on
both platforms using the same flag -lmylib
The '0' is the version number; you can control it by setting the
mylib_INTERFACE_VERSION = 2
variable. Eg, this would set it to '2' and generate a mylib-2.dll.
If you don't set xxx_INTERFACE_VERSION,
then the beginning of the xxx_VERSION variable is used. By default,
that variable is set to '0.0.0', which means
xxx_INTERFACE_VERSION gets set to '0', and you get mylib-0.dll. This
is all similar to Unix,
where symlinks get used for versioning and there is an interface
version.
I recommend you just set
mylib_VERSION = 1.0.0
which will generate a mylib-1.dll. Then, keep this mylib_VERSION
string up-to-date, and change the first number when
you want to signify a break in compatibility. Or use
xxx_INTERFACE_VERSION to fine tune when your
library has a significant incompatible change. :-)
Finally, if you are having a problem (ie, you can't actually link the
library you created!) let me know (can you
provide me the output of 'make messages=yes' when trying to link the
library). Make sure you install the library
before trying to link it. ;-)
Thanks
2009/2/24 Nicola Pero <nicola.pero@meta-innovation.com>
You want to use subprojects :-)
Your top level GNUmakefile should look like
include $(GNUSTEP_MAKEFILES)/common.make
LIBRARY_NAME = mylib
mylib_SUBPROJECTS = source1 source2
include $(GNUSTEP_MAKEFILES)/library.make
This will compile a single library, at top level, by linking
together the subprojects source1 and
source2.
Then, in source1 you need a GNUmakefile such as the following one:
include $(GNUSTEP_MAKEFILES)/common.make
SUBPROJECT_NAME = source1
source1_C_FILES = file11.c file12.c
include $(GNUSTEP_MAKEFILES)/subproject.make
This will compile the files and link them into a subproject, which
is then used by the top-level GNUmakefile.
In source2, you may want to add a similar GNUmakefiles.
Hope this helps! :-)
Let me know if you need more help
Thanks
On 24 Feb 2009, at 19:57, Julien Isorce wrote:
Hi,
I have a project where there is severals source directories:
source1, source2, source3
I want to compile the project to make only one shared library.
I have tried to use the following:
in the top directory:
------------------------------------------------------------------------
include $(GNUSTEP_MAKEFILES)/common.make
SUBPROJECTS = source1 source2
include $(GNUSTEP_MAKEFILES)/aggregate.make
------------------------------------------------------------------------
in source1 dir:
------------------------------------------------------------------------
include $(GNUSTEP_MAKEFILES)/common.make
LIBRARY_NAME = libmylib
libmylib_C_FILES = file11.c file12.c
include $(GNUSTEP_MAKEFILES)/library.make
------------------------------------------------------------------------
and in source2:
------------------------------------------------------------------------
include $(GNUSTEP_MAKEFILES)/common.make
LIBRARY_NAME = libmylib
libmylib_C_FILES += file21.c file22.c
include $(GNUSTEP_MAKEFILES)/library.make
------------------------------------------------------------------------
but it does not work.
Any solution ?
Thx
Sincerely
Julien
_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnustep