-
Notifications
You must be signed in to change notification settings - Fork 5
Normal Makefiles with Concerto
A normal top-level makefile for a project will normally be very simple.
include $(CONCERTO_ROOT)/rules.mak
That's it. You can either set the CONCERTO_ROOT
in your environment or include it in the Makefile
. The default assumptions about how your projects are structured are as follows:
<project>
source/
include/
Folders under source/
will be scanned recursively for concerto.mak
files.
Put a concerto.mak
file with these declarations in the folder where you want to build something (as a peer to the source code).
include $(PRELUDE)
TARGET:=mybin
TARGETTYPE:=exe
CSOURCES:=main.c
include $(FINALE)
For a static library, just supply the core of the target name, the platform nomenclature of libxxxx.a
will be automatically appended.
include $(PRELUDE)
TARGET:=mylib
TARGETTYPE:=library
CSOURCES:=mylib.c
include $(FINALE)
This will build a libmylib.a
on LINUX and mylib.lib
on Windows_NT derivatives.
include $(PRELUDE)
TARGET:=myobj
TARGETTYPE:=dsmo
CSOURCES:=myobj.c
include $(FINALE)
This will build libmyobj.so
on LINUX and myobj.dll
on Windows_NT derivatives.
When an object depends on another object, like a executable depending on a static library, we just add the library name to the STATIC_LIBS
variable.
include $(PRELUDE)
TARGET:=mybin
TARGETTYPE:=exe
CSOURCES:=main.c
STATIC_LIBS:=mylib
include $(FINALE)
Now mylib
will be built first, then mybin
. Dynamically shared objects use SHARED_LIBS
. For libraries outside the build system (which would live in /usr/lib or elsewhere) use SYS_STATIC_LIBS
or SYS_SHARED_LIBS
. A system library named libfoo.so
would be marked as a dependant as this:
include $(PRELUDE)
TARGET:=mybin
TARGETTYPE:=exe
CSOURCES:=main.c
STATIC_LIBS:=mylib
SYS_SHARED_LIBS:=foo
include $(FINALE)
The prefix and the postfix are OS dependant and can be removed to ensure OS independent makefiles.
include $(PRELUDE)
TARGET:=JarName
TARGETTYPE:=jar
JSOURCES:=$(call all-java-files)
JAVA_LIBS:=rxtxcomm
include $(FINALE)
Here another assumption is made, where the folder which contains the concerto.mak
has the java files arranged in their folder hierarchy.
concerto.mak
com/tsp/utils/Debug.java
If you want to be specific about where the source files are pulled, use $(call all-java-files-under,path/)
The entry class (which contains the main
) must be defined too if you which to run the jar as an executable.
ENTRY:=com.tsp.utils.Debug
In order to define multiple targets in one concerto.mak
file, you have to redefine the variable _MODULE
. _MODULE
is automatically to the name of the folder munged with some other variables.
_MODULE:=com.tsp.math
include $(PRELUDE)
TARGET=com.tsp.math
TARGETTYPE=jar
JSOURCES:=$(call all-java-files-under,com/tsp/math)
ENTRY := com.tsp.math.Test
include $(FINALE)
_MODULE := com.tsp.utils
include $(PRELUDE)
TARGET := com.tsp.utils
TARGETTYPE := jar
JSOURCES := $(call all-java-files-under,com/tsp/utils)
ENTRY := com.tsp.utils.Debug
include $(FINALE)