Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider a15737b6 rédigé par Cleber Rosa's avatar Cleber Rosa Validation de Jacek Czerwonka
Parcourir les fichiers

GNU/Linux build improvements (#20)


* Makefile: add clean target

While working on pict, it's useful to get a clean state.  This clean
target removes the target binary and output generated by a self test
execution (make test).

Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>

* Makefile: allow parallelization of build

The current rule for building pict is based on a single command
execution, which makes faster builds leveraging parallel execution
impossible.

This change introduces the objects that are required to build pict,
and relies on implicit rules to turn the ".cpp" files into the object
files.

After these changes, a command such as "make -j8" shows the benefits
of this change.

Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>

* api/pictapi.h: use default calling convention when using gcc

gcc doesn't understand the __stdcall calling convention.  Let's
use its default when using it as a compiler.

Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>

* Makefile: relax a bit more the compiler options

I reckon that pict should be compiled with all warnings enabled,
and all warnings being treated as errors.  This is actually the goal
of other changes to be proposed soon.

For now, some code, such as naming attributes with the same name as
previously declared types is not really welcomed by some compilers
such as GCC, being considered "nonconformant code".

Since changes to fix this would bring changes to the pict API, let's
keep things simple and simply allow the unchanged code to build on
other compilers such as GCC.

Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>

* Makefile: use default compiler set on system

Users can choose selected compiler by setting the "CXX" environment
variable or by editting the Makefile.

Let's not hardcode a particular compiler, now that both clang and gcc
can be used to compile pict.

Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>

* Makefile: make test depend on target being built

Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>

* Makefile: add source target

It's useful to generate a snapshot of the current state of the GIT
repo.  Let's add a target that generates a tarball using git-archive
using a naming convention that makes it easy to trace to the commit
that generated this snapshot.

This format also happens to be well suitable for using the source
tarball when packaging it in RPM format.

Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
parent e7092c9b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
CXX=clang++
# To use another compiler, such clang++, set the CXX variable
# CXX=clang++
# variables used to generate a source snapshot of the GIT repo
COMMIT=$(shell git log --pretty=format:'%H' -n 1)
SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1)
# suppress all warnings :-(
CXXFLAGS=-std=c++11 -Iapi -w
CXXFLAGS=-std=c++11 -Iapi -w -fpermissive
TARGET=pict
all:
$(CXX) $(CXXFLAGS) api/*cpp cli/*cpp -o $(TARGET)
TEST_OUTPUT = test/rel.log test/rel.log.failures test/dbg.log
TEST_OUTPUT += test/.stdout test/.stderr
OBJS = api/combination.o api/deriver.o api/exclusion.o
OBJS += api/model.o api/parameter.o api/pictapi.o
OBJS += api/task.o api/worklist.o cli/ccommon.o cli/cmdline.o
OBJS += cli/common.o cli/cparser.o cli/ctokenizer.o cli/gcd.o
OBJS += cli/gcdexcl.o cli/gcdmodel.o cli/model.o cli/mparser.o
OBJS += cli/pict.o cli/strings.o
test:
pict: $(OBJS)
$(CXX) $(OBJS) -o $(TARGET)
test: $(TARGET)
cd test; perl test.pl ../$(TARGET) rel.log
.PHONY: all test
clean:
rm -f $(TARGET) $(TEST_OUTPUT) $(OBJS)
all: pict
source: clean
git archive --prefix="pict-$(COMMIT)/" -o "pict-$(SHORT_COMMIT).tar.gz" $(COMMIT)
.PHONY: all test clean source
......@@ -13,7 +13,11 @@
#define OPT
#endif
#if defined( __GNUC__ )
#define API_SPEC
#else
#define API_SPEC __stdcall
#endif
#if defined( __cplusplus )
extern "C" {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter