From bdb608c3aed20424e19bda64f2ff9726870fe05a Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Fri, 22 Feb 2013 23:14:16 +0100 Subject: [PATCH] [makefile] fPIC for sim... --- conf/Makefile.sim | 8 ++++++++ sw/Makefile.ocaml | 1 + sw/simulator/Makefile | 12 +++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/conf/Makefile.sim b/conf/Makefile.sim index 7f95aad73d..c4ae1941f5 100644 --- a/conf/Makefile.sim +++ b/conf/Makefile.sim @@ -44,12 +44,20 @@ Q=@ # End of configuration part. # +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),64) + FPIC = -fPIC +else + FPIC = +endif + INCLUDES += -I `ocamlc -where` CFLAGS = -W -Wall CFLAGS += $(INCLUDES) CFLAGS += $($(TARGET).CFLAGS) CFLAGS += $(LOCAL_CFLAGS) +CFLAGS += $(FPIC) CFLAGS += -O2 CFLAGS += -g CFLAGS += -std=gnu99 diff --git a/sw/Makefile.ocaml b/sw/Makefile.ocaml index 3073724ed4..c3535f48d4 100644 --- a/sw/Makefile.ocaml +++ b/sw/Makefile.ocaml @@ -27,6 +27,7 @@ OCAMLC = ocamlc OCAMLOPT = ocamlopt OCAMLDEP = ocamldep OCAMLFIND = ocamlfind +OCAMLMKLIB = ocamlmklib LIBPPRZDIR = $(PAPARAZZI_SRC)/sw/lib/ocaml LIBPPRZCMA = $(LIBPPRZDIR)/lib-pprz.cma LIBPPRZCMXA = $(LIBPPRZCMA:.cma=.cmxa) diff --git a/sw/simulator/Makefile b/sw/simulator/Makefile index a61d583aae..74ac46830e 100644 --- a/sw/simulator/Makefile +++ b/sw/simulator/Makefile @@ -24,7 +24,7 @@ Q=@ LBITS := $(shell getconf LONG_BIT) ifeq ($(LBITS),64) - FPIC = -ccopt -fPIC + FPIC = -fPIC else FPIC = endif @@ -51,7 +51,8 @@ ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT) all : gaia sitl.cma simhitl fg.so : fg.o - gcc -shared -o $@ $^ + @echo BUILD $@ + $(Q)$(CC) -shared -o $@ $^ simhitl : fg.so $(SIMHCMO) simhitl.cmo @echo OL $@ @@ -59,9 +60,10 @@ simhitl : fg.so $(SIMHCMO) simhitl.cmo sitl.cma : fg.o $(SIMSCMO) @echo OL $@ - $(Q)ocamlmklib -o sitl $^ + $(Q)$(OCAMLMKLIB) -o sitl $^ sitl.cmxa : $(SIMSCMX) + @echo OC $@ $(Q)$(OCAMLOPT) -o $@ -a $^ gaia : gaia.cmo @@ -77,8 +79,8 @@ diffusion : stdlib.cmo diffusion.cmo $(Q)$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -c -package $(PKGCOMMON) $< %.o : %.c - @echo OC $< - $(Q)$(OCAMLFIND) $(OCAMLC) $(FPIC) -c -package $(PKGCOMMON) $< + @echo CC $< + $(Q)$(CC) $(FPIC) -c $< %.cmx : %.ml @echo OOC $<