diff --git a/.gitignore b/.gitignore index 65869e83e6..29c5f3133f 100644 --- a/.gitignore +++ b/.gitignore @@ -118,6 +118,7 @@ /sw/lib/ocaml/expr_parser.mli /sw/lib/ocaml/gtk_papget_led_editor.ml /sw/lib/ocaml/expr_lexer.ml +/sw/lib/ocaml/META.pprz # /sw/logalizer/ /sw/logalizer/plot diff --git a/Makefile b/Makefile index 45206cabaf..b59009f452 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,14 @@ OCAML=$(shell which ocaml) OCAMLRUN=$(shell which ocamlrun) BUILD_DATETIME:=$(shell date +%Y%m%d-%H%M%S) +# default mktemp in OS X doesn't work, use gmktemp with macports coreutils +UNAME = $(shell uname -s) +ifeq ("$(UNAME)","Darwin") + MKTEMP = gmktemp +else + MKTEMP = mktemp +endif + # # define some paths # @@ -57,6 +65,7 @@ MULTIMON=sw/ground_segment/multimon COCKPIT=sw/ground_segment/cockpit TMTC=sw/ground_segment/tmtc TOOLS=$(PAPARAZZI_SRC)/sw/tools +JOYSTICK=sw/ground_segment/joystick EXT=sw/ext # @@ -92,9 +101,6 @@ ABI_MESSAGES_H=$(STATICINCLUDE)/abi_messages.h GEN_HEADERS = $(MESSAGES_H) $(MESSAGES2_H) $(UBX_PROTOCOL_H) $(MTK_PROTOCOL_H) $(XSENS_PROTOCOL_H) $(DL_PROTOCOL_H) $(DL_PROTOCOL2_H) $(ABI_MESSAGES_H) -# default directory for temporary files -TMPDIR ?= /tmp - all: ground_segment ext lpctools print_build_version: @@ -111,26 +117,29 @@ conf/%.xml :conf/%.xml.example [ -L $@ ] || [ -f $@ ] || cp $< $@ -ground_segment: print_build_version update_google_version conf lib subdirs commands static +ground_segment: print_build_version update_google_version conf libpprz subdirs commands static -static: cockpit tmtc tools sim_static static_h +static: cockpit tmtc tools sim_static joystick static_h -lib: +libpprz: $(MAKE) -C $(LIB)/ocaml multimon: $(MAKE) -C $(MULTIMON) -cockpit: lib +cockpit: libpprz $(MAKE) -C $(COCKPIT) -tmtc: lib cockpit multimon +tmtc: libpprz cockpit multimon $(MAKE) -C $(TMTC) -tools: lib +tools: libpprz $(MAKE) -C $(TOOLS) -sim_static: lib +joystick: libpprz + $(MAKE) -C $(JOYSTICK) + +sim_static: libpprz $(MAKE) -C $(SIMULATOR) ext: @@ -144,56 +153,70 @@ subdirs: $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ -$(PPRZCENTER): lib +$(PPRZCENTER): libpprz -$(LOGALIZER): lib +$(LOGALIZER): libpprz static_h: $(GEN_HEADERS) $(MESSAGES_H) : $(MESSAGES_XML) tools $(Q)test -d $(STATICINCLUDE) || mkdir -p $(STATICINCLUDE) - @echo BUILD $@ - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_messages.out $< telemetry > $(TMPDIR)/msg.h - $(Q)mv $(TMPDIR)/msg.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_messages.out $< telemetry > $($@_TMP) + $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ $(MESSAGES2_H) : $(MESSAGES_XML) tools $(Q)test -d $(STATICINCLUDE) || mkdir -p $(STATICINCLUDE) - @echo BUILD $@ - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_messages2.out $< telemetry > $(TMPDIR)/msg2.h - $(Q)mv $(TMPDIR)/msg2.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_messages2.out $< telemetry > $($@_TMP) + $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ $(UBX_PROTOCOL_H) : $(UBX_XML) tools - @echo BUILD $@ - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_ubx.out $< > $(TMPDIR)/ubx.h - $(Q)mv $(TMPDIR)/ubx.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_ubx.out $< > $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ $(MTK_PROTOCOL_H) : $(MTK_XML) tools - @echo BUILD $@ - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_mtk.out $< > $(TMPDIR)/mtk.h - $(Q)mv $(TMPDIR)/mtk.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_mtk.out $< > $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ $(XSENS_PROTOCOL_H) : $(XSENS_XML) tools - @echo BUILD $@ - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_xsens.out $< > $(TMPDIR)/xsens.h - $(Q)mv $(TMPDIR)/xsens.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_xsens.out $< > $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ $(DL_PROTOCOL_H) : $(MESSAGES_XML) tools - @echo BUILD $@ - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_messages.out $< datalink > $(TMPDIR)/dl.h - $(Q)mv $(TMPDIR)/dl.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_messages.out $< datalink > $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ $(DL_PROTOCOL2_H) : $(MESSAGES_XML) tools - @echo BUILD $@ - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_messages2.out $< datalink > $(TMPDIR)/dl2.h - $(Q)mv $(TMPDIR)/dl2.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_messages2.out $< datalink > $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ $(ABI_MESSAGES_H) : $(MESSAGES_XML) tools - @echo BUILD $@ - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_abi.out $< airborne > $(TMPDIR)/abi.h - $(Q)mv $(TMPDIR)/abi.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_abi.out $< airborne > $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ include Makefile.ac @@ -218,10 +241,10 @@ paparazzi: chmod a+x $@ -install : +install: all $(MAKE) -f Makefile.install PREFIX=$(PREFIX) -uninstall : +uninstall: $(MAKE) -f Makefile.install PREFIX=$(PREFIX) uninstall @@ -274,7 +297,7 @@ test: all replace_current_conf_xml run_tests restore_conf_xml .PHONY: all print_build_version update_google_version ground_segment \ -subdirs $(SUBDIRS) conf ext lib multimon cockpit tmtc tools\ +subdirs $(SUBDIRS) conf ext libpprz multimon cockpit tmtc tools\ static sim_static lpctools commands install uninstall \ clean cleanspaces ab_clean dist_clean distclean dist_clean_irreversible \ test replace_current_conf_xml run_tests restore_conf_xml diff --git a/Makefile.ac b/Makefile.ac index cdd479e849..90e2b5e3d0 100644 --- a/Makefile.ac +++ b/Makefile.ac @@ -49,6 +49,13 @@ MODULES_DIR=$(PAPARAZZI_HOME)/conf/modules/ AUTOPILOT_H=$(AC_GENERATED)/autopilot_core.h AIRCRAFT_MD5=$(AIRCRAFT_CONF_DIR)/aircraft.md5 +UNAME = $(shell uname -s) +ifeq ("$(UNAME)","Darwin") + MKTEMP = gmktemp +else + MKTEMP = mktemp +endif + # "make Q=''" to get full echo Q=@ @@ -62,9 +69,6 @@ endif # telemetry periodic frequency defaults to 60Hz TELEMETRY_FREQUENCY ?= 60 -# default directory for temporary files -TMPDIR ?= /tmp - init: @[ -d $(PAPARAZZI_HOME) ] || (echo "Copying config example in your $(PAPARAZZI_HOME) directory"; mkdir -p $(PAPARAZZI_HOME); cp -a conf $(PAPARAZZI_HOME); cp -a data $(PAPARAZZI_HOME); mkdir -p $(PAPARAZZI_HOME)/var/maps; mkdir -p $(PAPARAZZI_HOME)/var/include) @@ -89,56 +93,70 @@ makefile_ac: $(MAKEFILE_AC) $(AIRFRAME_H) : $(CONF)/$(AIRFRAME_XML) $(CONF_XML) $(AIRCRAFT_MD5) $(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED) - @echo BUILD $@ - $(Q)$(TOOLS)/gen_airframe.out $(AC_ID) $(AIRCRAFT) $(MD5SUM) $< > $(TMPDIR)/airframe.h - $(Q)mv $(TMPDIR)/airframe.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)$(TOOLS)/gen_airframe.out $(AC_ID) $(AIRCRAFT) $(MD5SUM) $< > $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ $(Q)cp $(CONF)/airframes/airframe.dtd $(AIRCRAFT_CONF_DIR)/airframes $(RADIO_H) : $(CONF)/$(RADIO) $(CONF_XML) $(TOOLS)/gen_radio.out $(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED) - @echo BUILD $@ - $(Q)$(TOOLS)/gen_radio.out $< > $(TMPDIR)/radio.h - $(Q)mv $(TMPDIR)/radio.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)$(TOOLS)/gen_radio.out $< > $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ $(Q)cp $< $(AIRCRAFT_CONF_DIR)/radios $(PERIODIC_H) : $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF_XML) $(CONF)/$(TELEMETRY) $(MAKEFILE_AC) $(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED) - @echo BUILD $@ - $(Q)$(TOOLS)/gen_periodic.out $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF)/$(TELEMETRY) $(TELEMETRY_FREQUENCY) $(SETTINGS_TELEMETRY) > $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)$(TOOLS)/gen_periodic.out $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF)/$(TELEMETRY) $(TELEMETRY_FREQUENCY) $(SETTINGS_TELEMETRY) > $($@_TMP) + $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ - $(Q)cp $< $(AIRCRAFT_CONF_DIR) $(Q)cp $(CONF)/$(TELEMETRY) $(AIRCRAFT_CONF_DIR)/telemetry $(FLIGHT_PLAN_H) : $(CONF)/$(FLIGHT_PLAN) $(CONF_XML) $(TOOLS)/gen_flight_plan.out $(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED) - @echo BUILD $@ - $(Q)$(TOOLS)/gen_flight_plan.out $< > $(TMPDIR)/$(AC_ID)_fp.h - $(Q)mv $(TMPDIR)/$(AC_ID)_fp.h $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)$(TOOLS)/gen_flight_plan.out $< > $($@_TMP) + $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ $(Q)cp $< $(AIRCRAFT_CONF_DIR)/flight_plans $(FLIGHT_PLAN_XML) : $(CONF)/$(FLIGHT_PLAN) $(CONF_XML) $(TOOLS)/gen_flight_plan.out - @echo BUILD $@ - $(Q)$(TOOLS)/gen_flight_plan.out -dump $< > $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)$(TOOLS)/gen_flight_plan.out -dump $< > $($@_TMP) + $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ $(SETTINGS_H) : $(SETTINGS_XMLS) $(CONF_XML) $(SETTINGS_MODULES) $(SETTINGS_TELEMETRY) $(TOOLS)/gen_settings.out $(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED) - @echo BUILD $@ - $(Q)$(TOOLS)/gen_settings.out $(SETTINGS_XML) $(SETTINGS_TELEMETRY) $(SETTINGS_XMLS) $(SETTINGS_MODULES) > $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)$(TOOLS)/gen_settings.out $(SETTINGS_XML) $(SETTINGS_TELEMETRY) $(SETTINGS_XMLS) $(SETTINGS_MODULES) > $($@_TMP) + $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ $(Q)cp $(SETTINGS_XMLS) $(AIRCRAFT_CONF_DIR)/settings $(MODULES_H) : $(CONF)/$(AIRFRAME_XML) $(TOOLS)/gen_modules.out $(CONF)/modules/*.xml $(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED) - @echo BUILD $@ - $(Q)$(TOOLS)/gen_modules.out $(SETTINGS_MODULES) $< > $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)$(TOOLS)/gen_modules.out $(SETTINGS_MODULES) $< > $($@_TMP) + $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ $(AUTOPILOT_H) : $(CONF)/$(AIRFRAME_XML) $(TOOLS)/gen_autopilot.out $(CONF)/autopilot/*.xml $(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED) - @echo BUILD $@ - $(Q)$(TOOLS)/gen_autopilot.out $(CONF)/$(AIRFRAME_XML) $@ + @echo GENERATE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)$(TOOLS)/gen_autopilot.out $(CONF)/$(AIRFRAME_XML) $($@_TMP) + $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ $(SETTINGS_MODULES) : $(MODULES_H) diff --git a/conf/Makefile.avr b/conf/Makefile.avr index 7f38e698cd..621820347d 100644 --- a/conf/Makefile.avr +++ b/conf/Makefile.avr @@ -171,7 +171,7 @@ check_arch : $(Q)if ($(UISP) $(UISP_FLAGS) 2>&1 | tr '[:upper:]' '[:lower:]' | grep $($(TARGET).MCU)); then : ; else echo "Wrong architecture (mcu0 vs mcu1 ?)"; exit 1; fi avr_clean: - rm -rf $(OBJDIR) + $(Q)rm -rf $(OBJDIR) # diff --git a/conf/Makefile.sim b/conf/Makefile.sim index d494e44845..6e892e09e3 100644 --- a/conf/Makefile.sim +++ b/conf/Makefile.sim @@ -27,10 +27,13 @@ # this should not be needed SRC_ARCH = arch/sim +include $(PAPARAZZI_SRC)/sw/Makefile.ocaml + CC = gcc -OCAMLC = ocamlc SIMDIR = $(PAPARAZZI_SRC)/sw/simulator -CAMLINCLUDES = $(shell ocamlfind query -r -i-format lablgtk2) -I $(PAPARAZZI_SRC)/sw/lib/ocaml -I $(SIMDIR) $(shell ocamlfind query -r -i-format xml-light) +CAMLINCLUDES = -I $(LIBPPRZDIR) -I $(SIMDIR) -I $(OBJDIR) +PKG = -package glibivy,pprz +LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz SIMSITLML = $(OBJDIR)/simsitl.ml MYGTKINITCMO = myGtkInit.cmo SITLCMA = $(SIMDIR)/sitl.cma @@ -42,12 +45,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 @@ -65,10 +76,14 @@ $(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o) all compile: $(OBJDIR)/simsitl +# shared library of the C autopilot part +autopilot.so : $($(TARGET).objs) + @echo BUILD $@ + $(Q)$(CC) -shared -o $(OBJDIR)/$@ $^ -$(OBJDIR)/simsitl : $($(TARGET).objs) $(SITLCMA) $(SIMSITLML) +$(OBJDIR)/simsitl : autopilot.so $(SITLCMA) $(SIMSITLML) @echo LD $@ - $(Q)$(OCAMLC) -g -custom $(CAMLINCLUDES) -o $@ unix.cma str.cma xml-light.cma glibivy-ocaml.cma lib-pprz.cma lablgtk.cma $($(TARGET).objs) $(MYGTKINITCMO) $(SITLCMA) $(SIMSITLML) + $(Q)$(OCAMLC) -g $(CAMLINCLUDES) -o $@ $(LINKPKG) $(MYGTKINITCMO) $^ -dllpath $(OBJDIR) -dllpath $(SIMDIR) # The id of the A/C is hardcoded in the code (to be improved with dynlink ?) diff --git a/conf/gps/Makefile b/conf/gps/Makefile index 9cc7e8a4ec..17a823a983 100644 --- a/conf/gps/Makefile +++ b/conf/gps/Makefile @@ -1,11 +1,14 @@ +# Quiet compilation +Q=@ + CC=gcc MODCFLAGS=-Wall all: ublox_conf clean: - rm -f core *.o ublox_conf + $(Q)rm -f core *.o ublox_conf ublox_conf: ublox_conf.c Makefile $(CC) $(MODCFLAGS) ublox_conf.c -o ublox_conf diff --git a/data/maps/Makefile b/data/maps/Makefile index 9e8dd00a43..13c26a90c6 100644 --- a/data/maps/Makefile +++ b/data/maps/Makefile @@ -3,13 +3,17 @@ DATADIR = $(PAPARAZZI_HOME)/conf/maps_data Q=@ -# default directory for temporary files -TMPDIR ?= /tmp +UNAME = $(shell uname -s) +ifeq ("$(UNAME)","Darwin") + MKTEMP = gmktemp +else + MKTEMP = mktemp +endif all: $(PAPARAZZI_HOME)/conf/maps.xml clean: - rm -f $(DATADIR)/maps.google.com + $(Q)rm -f $(DATADIR)/maps.google.com $(DATADIR): mkdir $(DATADIR) @@ -25,13 +29,15 @@ $(DATADIR)/maps.google.com: $(DATADIR) FORCE $(PAPARAZZI_HOME)/conf/maps.xml: $(DATADIR)/maps.google.com $(eval GOOGLE_VERSION := $(shell grep -E "http://khm[0-9]+.google.com/kh/v=[0-9]+.x26" $(DATADIR)/maps.google.com | sed -E 's#.*http://khm[0-9]+.google.com/kh/v=##;s#.x26.*##')) + $(eval $@_TMP := $(shell $(MKTEMP))) @echo "Updated google maps version to $(GOOGLE_VERSION)" @echo "-----------------------------------------------" - $(Q)echo "" > $(TMPDIR)/maps.xml - $(Q)echo "" >> $(TMPDIR)/maps.xml - $(Q)echo "" >> $(TMPDIR)/maps.xml - $(Q)echo "" >> $(TMPDIR)/maps.xml - $(Q)mv $(TMPDIR)/maps.xml $@ + $(Q)echo "" > $($@_TMP) + $(Q)echo "" >> $($@_TMP) + $(Q)echo "" >> $($@_TMP) + $(Q)echo "" >> $($@_TMP) + $(Q)mv $($@_TMP) $@ + $(Q)chmod a+r $@ FORCE: .PHONY: all clean diff --git a/doc/ccc07/Makefile b/doc/ccc07/Makefile index 51e8d67950..85582a8b98 100644 --- a/doc/ccc07/Makefile +++ b/doc/ccc07/Makefile @@ -1,8 +1,11 @@ +# Quiet compilation +Q=@ + slides : slides.tex $(PDF) $(ANIMS) pdflatex slides clean: - rm -f *~ *.log *.nav *.out *.snm *.toc *.aux slides.pdf + $(Q)rm -f *~ *.log *.nav *.out *.snm *.toc *.aux slides.pdf diff --git a/doc/pprz_algebra/Makefile b/doc/pprz_algebra/Makefile index 47828837b5..fce77e95fa 100644 --- a/doc/pprz_algebra/Makefile +++ b/doc/pprz_algebra/Makefile @@ -1,8 +1,11 @@ +# Quiet compilation +Q=@ + doc_pprz_algebra.pdf: headfile.tex pdflatex $< bib: bibtex headfile clean: - rm -f *~ *.aux *.bbl *.blg *.log *.out *.toc *.dvi *.ps - find . -name '*~' -exec rm -f {} \; + $(Q)rm -f *~ *.aux *.bbl *.blg *.log *.out *.toc *.dvi *.ps + $(Q)find . -name '*~' -exec rm -f {} \; diff --git a/doc/pprz_geodetic/Makefile b/doc/pprz_geodetic/Makefile index 47828837b5..fce77e95fa 100644 --- a/doc/pprz_geodetic/Makefile +++ b/doc/pprz_geodetic/Makefile @@ -1,8 +1,11 @@ +# Quiet compilation +Q=@ + doc_pprz_algebra.pdf: headfile.tex pdflatex $< bib: bibtex headfile clean: - rm -f *~ *.aux *.bbl *.blg *.log *.out *.toc *.dvi *.ps - find . -name '*~' -exec rm -f {} \; + $(Q)rm -f *~ *.aux *.bbl *.blg *.log *.out *.toc *.dvi *.ps + $(Q)find . -name '*~' -exec rm -f {} \; diff --git a/sw/Makefile.ocaml b/sw/Makefile.ocaml new file mode 100644 index 0000000000..682a382c72 --- /dev/null +++ b/sw/Makefile.ocaml @@ -0,0 +1,38 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# Copyright (C) 2013 Gautier Hattenberger +# +# This file is part of paparazzi. +# +# paparazzi is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# paparazzi is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with paparazzi; see the file COPYING. If not, write to +# the Free Software Foundation, 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +# General ocaml compiling tools and pprz lib + +OCAML = ocaml +OCAMLC = ocamlfind ocamlc +OCAMLOPT = ocamlfind ocamlopt +OCAMLDEP = ocamldep +OCAMLMKLIB = ocamlmklib +LIBPPRZDIR = $(PAPARAZZI_SRC)/sw/lib/ocaml +LIBPPRZCMA = $(LIBPPRZDIR)/lib-pprz.cma +LIBPPRZCMXA = $(LIBPPRZCMA:.cma=.cmxa) +XLIBPPRZCMA = $(LIBPPRZDIR)/xlib-pprz.cma +XLIBPPRZCMXA = $(XLIBPPRZCMA:.cma=.cmxa) +OCAMLDLL = -dllpath $(LIBPPRZDIR) +OCAMLXDLL = -dllpath $(LIBPPRZDIR) + +export OCAMLPATH=$(LIBPPRZDIR):$OCAMLPATH diff --git a/sw/airborne/Makefile b/sw/airborne/Makefile index dea5860293..7ad1a52999 100644 --- a/sw/airborne/Makefile +++ b/sw/airborne/Makefile @@ -21,6 +21,9 @@ # Boston, MA 02111-1307, USA. # +# Quiet compilation +Q=@ + OBJDIR = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/$(TARGET) VARINCLUDE=$(PAPARAZZI_HOME)/var/include @@ -51,10 +54,6 @@ ifneq ($(MAKECMDGOALS),clean) # sort cflags and sources to throw out duplicates # - #$(info CFLAGS_orig = $($(TARGET).CFLAGS)) - #$(info CFLAGS_sort = $(sort $($(TARGET).CFLAGS))) - #$(info srcs_orig = $($(TARGET).srcs)) - #$(info srcs_sort = $(sort $($(TARGET).srcs))) $(TARGET).CFLAGS := $(sort $($(TARGET).CFLAGS)) $(TARGET).srcs := $(sort $($(TARGET).srcs)) endif @@ -72,5 +71,5 @@ warn_conf : @echo clean : - rm -f *~ a.out *.elf + $(Q)rm -f *~ a.out *.elf .PHONY: clean diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/Makefile b/sw/airborne/arch/lpc21/lpcusb/examples/Makefile index e9073abae5..ed8af37aa3 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/Makefile +++ b/sw/airborne/arch/lpc21/lpcusb/examples/Makefile @@ -1,3 +1,6 @@ +# Quiet compilation +Q=@ + LIBNAME = ../libusbstack APPNAME = main @@ -41,7 +44,7 @@ crt.o: crt.s $(CC) -c $(AFLAGS) -Wa,-ahlms=crt.lst crt.s -o crt.o clean: - rm -f *.hex *.elf *.o *.lst *.dmp *.map .depend + $(Q)rm -f *.hex *.elf *.o *.lst *.dmp *.map .depend # recompile if the Makefile changes $(OBJS): Makefile diff --git a/sw/airborne/arch/lpc21/test/bootloader/Makefile b/sw/airborne/arch/lpc21/test/bootloader/Makefile index 7f7bc7666b..faec6d79e1 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/Makefile +++ b/sw/airborne/arch/lpc21/test/bootloader/Makefile @@ -1,3 +1,6 @@ +# Quiet compilation +Q=@ + #PROC_AP PROC_FBW PROC_TINY PROC_TINYJ #PROC = TINYJ ALLFLAGS = -DPROC_$(PROC) @@ -37,9 +40,9 @@ LIBOBJS = usbhw_lpc.o usbcontrol.o usbstdreq.o usbinit.o usbdescrip.o all: lib app app_ram clean: - $(RM) -f $(LIBNAME).a $(LIBOBJS) - $(RM) -f $(APPNAME).hex $(APPNAME).elf $(OBJS) *.lst $(APPNAME).dmp $(APPNAME).map - $(RM) -f $(APPNAME_RAM).hex $(APPNAME_RAM).elf $(APPNAME_RAM).dmp $(APPNAME_RAM).map + $(Q)$(RM) -f $(LIBNAME).a $(LIBOBJS) + $(Q)$(RM) -f $(APPNAME).hex $(APPNAME).elf $(OBJS) *.lst $(APPNAME).dmp $(APPNAME).map + $(Q)$(RM) -f $(APPNAME_RAM).hex $(APPNAME_RAM).elf $(APPNAME_RAM).dmp $(APPNAME_RAM).map # build lib lib: $(LIBOBJS) diff --git a/sw/airborne/booz/test/Makefile b/sw/airborne/booz/test/Makefile index f218803525..164960f6e7 100644 --- a/sw/airborne/booz/test/Makefile +++ b/sw/airborne/booz/test/Makefile @@ -21,6 +21,9 @@ # Boston, MA 02111-1307, USA. ## +# Quiet compilation +Q=@ + CC = gcc CFLAGS = -std=gnu99 -Wall -I.. -I../.. -I../../test/ -I../../../include -I../../booz_priv LDFLAGS = -lm @@ -51,4 +54,4 @@ test_att_ref: test_att_ref.c ../stabilization/booz_stabilization_attitude_ref_qu clean: - rm -f *~ test_att_ref + $(Q)rm -f *~ test_att_ref diff --git a/sw/airborne/firmwares/non_ap/led_flasher/Makefile b/sw/airborne/firmwares/non_ap/led_flasher/Makefile index 9408d7238f..33305dca62 100644 --- a/sw/airborne/firmwares/non_ap/led_flasher/Makefile +++ b/sw/airborne/firmwares/non_ap/led_flasher/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + MCU = attiny25 PROG = dragon_isp @@ -19,7 +22,7 @@ SOURCES = blitzer.c all: $(APPNAME) clean: - $(RM) -f core $(APPNAME).o $(APPNAME) $(APPNAME).elf $(APPNAME).hex + $(Q)$(RM) -f core $(APPNAME).o $(APPNAME) $(APPNAME).elf $(APPNAME).hex app: $(APPNAME) diff --git a/sw/airborne/firmwares/vor/Makefile b/sw/airborne/firmwares/vor/Makefile index 2a8cdd9f0c..d55b7cd51d 100644 --- a/sw/airborne/firmwares/vor/Makefile +++ b/sw/airborne/firmwares/vor/Makefile @@ -1,3 +1,6 @@ +# Quiet compilation +Q=@ + all: CFLAGS = -Wall -I.. @@ -25,7 +28,7 @@ play_audio: sndfile-play.c gcc $(CFLAGS) $^ -o $@ $(LDFLAGS) -lsndfile -lasound clean: - rm -f i86_vor_test_float_demod \ + $(Q)rm -f i86_vor_test_float_demod \ i86_vor_test_int_demod \ i86_vor_test_filters \ *~ \#* diff --git a/sw/airborne/fms/Makefile b/sw/airborne/fms/Makefile index 6e568312f7..588e846c28 100644 --- a/sw/airborne/fms/Makefile +++ b/sw/airborne/fms/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + CFLAGS = -Wall $(shell pkg-config --cflags glib-2.0) -g LDFLAGS = $(shell pkg-config --libs glib-2.0) @@ -49,4 +52,4 @@ onboard_logger: onboard_logger.c $(CC) $(CFLAGS) -o $@ $^ -lpcap clean: - rm -f *~ fms test_telemetry + $(Q)rm -f *~ fms test_telemetry diff --git a/sw/airborne/fms/libeknav/Makefile b/sw/airborne/fms/libeknav/Makefile index 5f0c3e111f..b79daa59ba 100644 --- a/sw/airborne/fms/libeknav/Makefile +++ b/sw/airborne/fms/libeknav/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + raw_log_to_ascii: raw_log_to_ascii.c gcc -I../../ -I../../../include -std=gnu99 -Wall raw_log_to_ascii.c -DOVERO_LINK_MSG_UP=AutopilotMessageVIUp -DOVERO_LINK_MSG_DOWN=AutopilotMessageVIDown -o raw_log_to_ascii @@ -26,4 +29,4 @@ run_filter_on_log: ./libeknav_from_log.cpp $(LIBEKNAV_SRCS) ../../math/pprz_geod g++ -I/usr/include/eigen2 -I../.. -I../../../include -I../../../../var/FY $(eknavOnLogFlags) -o $@ $^ clean: - -rm -f *.o *~ *.d + $(Q)rm -f *.o *~ *.d diff --git a/sw/airborne/math/Makefile b/sw/airborne/math/Makefile index 7030d668bf..f9caa61f30 100644 --- a/sw/airborne/math/Makefile +++ b/sw/airborne/math/Makefile @@ -1,6 +1,9 @@ # Build shared pprz math library # +# Quiet compilation +Q=@ + CC= gcc CFLAGS= -fpic INCLUDES= -I$(PAPARAZZI_SRC)/sw/include -I$(PAPARAZZI_SRC)/sw/airborne @@ -43,5 +46,5 @@ $(BUILDDIR)/%.o: %.c $(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@ clean: - rm -f $(BUILDDIR)/*.o $(BUILDDIR)/$(LIBNAME).so + $(Q)rm -f $(BUILDDIR)/*.o $(BUILDDIR)/$(LIBNAME).so diff --git a/sw/airborne/test/Makefile b/sw/airborne/test/Makefile index 13aeae8f7d..f8e05d1151 100644 --- a/sw/airborne/test/Makefile +++ b/sw/airborne/test/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + CC = gcc CFLAGS = -std=c99 -I.. -I../../include -I../booz -I../../booz -Wall @@ -33,4 +36,4 @@ test_fmul: test_fmul.c $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) clean: - rm -f *~ test_geodetic test_algebra *.exe + $(Q)rm -f *~ test_geodetic test_algebra *.exe diff --git a/sw/ground_segment/cockpit/Makefile b/sw/ground_segment/cockpit/Makefile index c3697ac744..84703ccffa 100644 --- a/sw/ground_segment/cockpit/Makefile +++ b/sw/ground_segment/cockpit/Makefile @@ -33,19 +33,15 @@ else endif FPIC=-fPIC -OCAMLC=ocamlc -OCAMLOPT=ocamlopt -OCAMLDEP=ocamldep -OCAMLOPTFLAGS=-thread -OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) -OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring) $(shell ocamlfind query -r -a-format -predicates byte netclient) -LIBPPRZDIR=../../lib/ocaml -INCLUDES= $(shell ocamlfind query -r -i-format lablgtk2) -I $(LIBPPRZDIR) $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format pcre) $(OCAMLNETINCLUDES) -LIBS=$(OCAMLNETCMA) glibivy-ocaml.cma lablgtk.cma lablglade.cma lib-pprz.cma lablgnomecanvas.cma xlib-pprz.cma -CMXA=$(LIBS:.cma=.cmxa) -LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma -LIBPPRZCMXA=$(LIBPPRZCMA:.cma=.cmxa) -XLIBPPRZCMA=$(LIBPPRZDIR)/xlib-pprz.cma +include ../../Makefile.ocaml + +INCLUDES= +LIBS= +LIBSX=$(LIBS:.cma=.cmxa) + +INCLUDES= -I ../multimon +PKG = -package pprz.xlib +LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz.xlib ML= gtk_setting_time.ml gtk_strip.ml horizon.ml strip.ml gtk_save_settings.ml saveSettings.ml page_settings.ml pages.ml speech.ml plugin.ml sectors.ml map2d.ml editFP.ml live.ml particules.ml papgets.ml gcs.ml MAIN=gcs @@ -56,45 +52,49 @@ all : $(MAIN) opt : $(MAIN).opt -$(MAIN) : $(CMO) $(XLIBPPRZCMA) $(LIBPPRZCMA) +$(MAIN) : $(CMO) @echo OL $@ - $(Q)$(OCAMLC) $(OCAMLCFLAGS) -custom $(INCLUDES) $(OCAMLNETINCLUDES) unix.cma str.cma netstring.cma netclient.cma xml-light.cma $(LIBS) threads.cma gtkThread.cmo myGtkInit.cmo $(CMO) -o $@ + $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) $(LIBS) $(LINKPKG) myGtkInit.cmo $(CMO) -o $@ $(MAIN).opt : $(CMX) @echo OOL $@ - $(Q)$(OCAMLOPT) $(OCAMLCFLAGS) $(INCLUDES) str.cmxa unix.cmxa xml-light.cmxa $(LIBS:.cma=.cmxa) threads.cmxa gtkThread.cmx gtkInit.cmx $(CMX) -o $@ + $(Q)$(OCAMLOPT) $(OCAMLCFLAGS) $(INCLUDES) $(LIBSX) -package pprz.xlib,lablgtk2.init -linkpkg $(CMX) -o $@ %.cmo: %.ml @echo OC $< - $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) $(PKG) -c $< %.cmi: %.mli @echo OCI $< - $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) $(PKG) -c $< %.cmx: %.ml @echo OOC $< - $(Q)$(OCAMLOPT) $(OCAMLCFLAGS) $(INCLUDES) -c $< + $(Q)$(OCAMLOPT) $(OCAMLCFLAGS) $(INCLUDES) $(PKG) -c $< saveSettings.cmo : gtk_save_settings.cmo saveSettings.cmx: gtk_save_settings.cmx gtk_strip.ml : gcs.glade - lablgladecc2 -root eventbox_strip -hide-default $< | grep -B 1000000 " end" > $@ + @echo GLADE $@ + $(Q)lablgladecc2 -root eventbox_strip -hide-default $< | grep -B 1000000 " end" > $@ gtk_setting_time.ml : gcs.glade - lablgladecc2 -root setting_time -hide-default $< | grep -B 1000000 " end" > $@ + @echo GLADE $@ + $(Q)lablgladecc2 -root setting_time -hide-default $< | grep -B 1000000 " end" > $@ gtk_save_settings.ml : gcs.glade - lablgladecc2 -root save_settings -hide-default $< | grep -B 1000000 " end" > $@ + @echo GLADE $@ + $(Q)lablgladecc2 -root save_settings -hide-default $< | grep -B 1000000 " end" > $@ strip.cmo : gtk_strip.cmo gtk_setting_time.cmo compass : compass.ml - $(OCAMLC) -custom $(OCAMLCFLAGS) $(INCLUDES) unix.cma str.cma xml-light.cma $(LIBS) gtkInit.cmo $^ -o $@ + @echo OL $@ + $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) $(LINKPKG) gtkInit.cmo $^ -o $@ clean: - rm -f *~* *.cm* *.o *.out *.opt map2d gcs .depend gtk_strip.ml gtk_setting_time.ml gtk_save_settings.ml compass ant_track ant_track_pmm test_enose actuators + $(Q)rm -f *~* *.cm* *.o *.out *.opt map2d gcs .depend gtk_strip.ml gtk_setting_time.ml gtk_save_settings.ml compass ant_track ant_track_pmm test_enose actuators .PHONY: all opt clean diff --git a/sw/ground_segment/joystick/Makefile b/sw/ground_segment/joystick/Makefile index f97df266ef..ce13743102 100644 --- a/sw/ground_segment/joystick/Makefile +++ b/sw/ground_segment/joystick/Makefile @@ -24,38 +24,75 @@ # Quiet compilation Q=@ -OCAMLC = ocamlc -OCAMLDEP = ocamldep -LIBPPRZDIR = ../../lib/ocaml +include ../../Makefile.ocaml TOOLSDIR = ../../tools -OCAMLINCLUDES= -I $(LIBPPRZDIR) $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) -I $(TOOLSDIR) -LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma + +CC = gcc + +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),64) + FPIC=-fpic +else + FPIC= +endif + +OCAMLINCLUDES= -I $(TOOLSDIR) +PKG = -package pprz,glibivy +LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz + +GLIB_CFLAGS = -Wall $(shell pkg-config glib-2.0 --cflags) $(FPIC) +GLIB_LDFLAGS = $(shell pkg-config glib-2.0 --libs) -lglibivy # apparently on OSX `sdl-config --libs` also has -lSDLmain which we don't want -#ML_SDL_LFLAGS = $(foreach u,$(shell sdl-config --libs),-cclib $(u)) -ML_SDL_LFLAGS = $(foreach u,$(shell pkg-config sdl --libs-only-L) -lSDL,-cclib $(u)) -INCLUDES += -I `ocamlc -where` +SDL_LDIRS = $(shell pkg-config sdl --libs-only-L) +SDL_LIBS = -lSDL +# we do however need -lSDLmain for test_stick, which is just c +SDL_LDFLAGS = $(shell sdl-config --libs) + +# apparently on OSX `sdl-config --libs` also has -lSDLmain which we don't want +ML_SDL_LFLAGS = $(foreach u,$(SDL_LDIRS),-ccopt $(u)) $(foreach u,$(SDL_LIBS),-cclib $(u)) libSDL.so +ML_SDL_LFLAGS += -dllpath ${PAPARAZZI_SRC}/sw/ground_segment/joystick +INCLUDES += -I $(shell ocamlc -where) + +SDL_STICK_DEPS = sdl_stick.o ml_sdl_stick.o +# apparently on OSX you cannot dynamically link with SDL, see ocamlsdl readme +UNAME = $(shell uname -s) + +ifeq ("$(UNAME)","Darwin") + ML_SDL_OCAMLFLAGS = -custom + INPUT2IVY_DEPS = $(SDL_STICK_DEPS) input2ivy.cmo +else + ML_SDL_OCAMLFLAGS = + INPUT2IVY_DEPS = sdl_stick.so input2ivy.cmo +endif all: test_stick input2ivy test_stick: test_sdl_stick.o - gcc -g -O2 -Wall -DSTICK_DBG `pkg-config glib-2.0 --cflags` -o $@ $^ sdl_stick.c `pkg-config glib-2.0 --libs` -lglibivy `sdl-config --libs` + @echo BUILD $@ + $(Q)$(CC) -g -O2 -DSTICK_DBG $(GLIB_CFLAGS) -o $@ $^ sdl_stick.c $(GLIB_LDFLAGS) $(SDL_LDFLAGS) -input2ivy: sdl_stick.o ml_sdl_stick.o input2ivy.cmo - $(OCAMLC) $(OCAMLINCLUDES) -o $@ unix.cma str.cma glibivy-ocaml.cma xml-light.cma lib-pprz.cma lablgtk.cma $(TOOLSDIR)/fp_proc.cmo $^ -custom $(ML_SDL_LFLAGS) +input2ivy: $(INPUT2IVY_DEPS) + @echo OL $@ + $(Q)$(OCAMLC) $(OCAMLINCLUDES) -o $@ $(LINKPKG) $(TOOLSDIR)/fp_proc.cmo $^ $(ML_SDL_OCAMLFLAGS) $(ML_SDL_LFLAGS) # dependency of input2ivy -input2ivy: $(LIBPPRZCMA) $(TOOLSDIR)/fp_proc.cmo +input2ivy: $(TOOLSDIR)/fp_proc.cmo + +sdl_stick.so : $(SDL_STICK_DEPS) + @echo BUILD $@ + $(Q)$(CC) -shared -o $@ $^ %.o : %.c - gcc -c -O2 -Wall `pkg-config glib-2.0 --cflags` $(INCLUDES) $< + @echo CC $@ + $(Q)$(CC) -c -O2 $(GLIB_CFLAGS) $(INCLUDES) $< %.cmo : %.ml @echo OC $< - $(Q)$(OCAMLC) $(OCAMLINCLUDES) -c $< + $(Q)$(OCAMLC) $(OCAMLINCLUDES) -c $(PKG) $< clean: - rm -f *~ core *.o *.bak .depend test*stick *.cmo *.cmi input2ivy + $(Q)rm -f *~ core *.o *.bak .depend test*stick *.cmo *.cmi input2ivy .PHONY: all clean diff --git a/sw/ground_segment/lpc21iap/Makefile b/sw/ground_segment/lpc21iap/Makefile index aa21d78a0b..d23ffc95b9 100644 --- a/sw/ground_segment/lpc21iap/Makefile +++ b/sw/ground_segment/lpc21iap/Makefile @@ -1,5 +1,8 @@ #MS VC: cl lpc21iap.c elf.c lpcusb.c libusb.lib +# Quiet compilation +Q=@ + LIBNAME = usb APPNAME = lpc21iap @@ -38,7 +41,7 @@ SOURCES = lpc21iap.c elf.c lpcusb.c all: $(APPNAME) clean: - $(RM) -f core $(APPNAME).o $(APPNAME) $(APPNAME).obj $(APPNAME).exe + $(Q)$(RM) -f core $(APPNAME).o $(APPNAME) $(APPNAME).obj $(APPNAME).exe app: $(APPNAME) diff --git a/sw/ground_segment/misc/Makefile b/sw/ground_segment/misc/Makefile index b07280b130..b703963916 100644 --- a/sw/ground_segment/misc/Makefile +++ b/sw/ground_segment/misc/Makefile @@ -38,7 +38,7 @@ endif all: davis2ivy kestrel2ivy clean: - rm -f *.o davis2ivy kestrel2ivy + $(Q)rm -f *.o davis2ivy kestrel2ivy davis2ivy: davis2ivy.o $(Q)$(CC) -o davis2ivy davis2ivy.o $(LIBRARYS) -livy diff --git a/sw/ground_segment/misc/davis2ivy.c b/sw/ground_segment/misc/davis2ivy.c index 734fbe9093..b4a876bf14 100644 --- a/sw/ground_segment/misc/davis2ivy.c +++ b/sw/ground_segment/misc/davis2ivy.c @@ -101,7 +101,8 @@ void open_port(const char* device) { /// disable transactions and empty queue void reset_station() { - char newline = '\n', bytes = 0; + char newline = '\n'; + char bytes __attribute__ ((unused)); fprintf(stderr, "Resetting communication\n"); // send a \n (wakeup and cancel all running transmits) bytes = write(fd, &newline, 1); diff --git a/sw/ground_segment/multimon/Makefile b/sw/ground_segment/multimon/Makefile index 0ac487b1b7..7ba8d002fd 100644 --- a/sw/ground_segment/multimon/Makefile +++ b/sw/ground_segment/multimon/Makefile @@ -23,83 +23,80 @@ # Launch with "make Q=''" to get full command display Q=@ -DEBUG =n -MACHINE := $(shell uname -m) -AS86 =as86 -0 -a -LD86 =ld86 -0 -AS =as -LD =ld -LDFLAGS =-lm -HOSTCC =gcc -CC =gcc -MAKE =make -CPP =$(CC) -E -AR =ar -STRIP =strip -MKDIR =mkdir -OCAMLC =ocamlc +DEBUG=n +MACHINE:=$(shell uname -m) +AS86=as86 -0 -a +LD86=ld86 -0 +AS=as +LD=ld +LDFLAGS=-lm +HOSTCC=gcc +CC=gcc +MAKE=make +CPP=$(CC) -E +AR=ar +STRIP=strip +MKDIR=mkdir -CFLAGS =-Wall -Wstrict-prototypes -I/usr/X11R6/include -I`$(OCAMLC) -where` +include ../../Makefile.ocaml + +CFLAGS=-Wall -Wstrict-prototypes -I/usr/X11R6/include -I`$(OCAMLC) -where` ifeq ($(DEBUG),y) - CFLAGS +=-g -O + CFLAGS += -g -O else - CFLAGS +=-O3 + CFLAGS += -O3 endif LBITS := $(shell getconf LONG_BIT) ifeq ($(LBITS),64) - CFLAGS += -fPIC + CFLAGS += -fPIC else ifeq ($(MACHINE),'i686') - CFLAGS += -march=i486 -falign-loops=2 -falign-jumps=2 -falign-functions=2 -DARCH_I386 + CFLAGS += -march=i486 -falign-loops=2 -falign-jumps=2 -falign-functions=2 -DARCH_I386 endif -LDFLAGSX =-lX11 -L/usr/X11R6/lib +LDFLAGSX = -lX11 -L/usr/X11R6/lib -#BINDIR =bin-$(shell uname -m) -BINDIR =. +#BINDIR = bin-$(shell uname -m) +BINDIR =. UNAME = $(shell uname -s) -ifeq ("$(UNAME)","Linux") +ifneq (,$(findstring $(UNAME),linux Linux)) OBJFILES=pprzlib.o hdlc.o demod_afsk12.o demodml.o costabi.o gen_hdlc.o ml_hdlc.o demod.cmo hdlc.cmo ALLTARGETS=$(BINDIR)/multimon multimon.cma endif -ifeq ("$(UNAME)","linux") - OBJFILES=pprzlib.o hdlc.o demod_afsk12.o demodml.o costabi.o gen_hdlc.o ml_hdlc.o demod.cmo hdlc.cmo - ALLTARGETS=$(BINDIR)/multimon multimon.cma -endif -ifeq ("$(UNAME)","Darwin") +ifeq ($(UNAME),Darwin) OBJFILES=demodml.o ml_hdlc.o demod.cmo hdlc.cmo ALLTARGETS=multimon.cma endif -all: $(ALLTARGETS) +all: $(ALLTARGETS) -multimon.cma: $(OBJFILES) +multimon.cma: $(OBJFILES) @echo OLD $@ $(Q)ocamlmklib -o multimon $^ $(BINDIR)/%.s: %.c - $(CC) $(CFLAGS) -S -o $@ $< + $(CC) $(CFLAGS) -S -o $@ $< $(BINDIR)/%.o: $(BINDIR)/%.s - $(AS) -c -o $@ $< + $(AS) -c -o $@ $< $(BINDIR)/%.o: %.c @echo CC $< $(Q)$(CC) $(CFLAGS) -c -o $@ $< -SRC_L2 = hdlc.c pprz.c -SRC_L1 = demod_afsk48p.c demod_display.c -SRC_MISC = unixinput.c xdisplay.c +SRC_L2 = hdlc.c pprz.c +SRC_L1 = demod_afsk48p.c demod_display.c +SRC_MISC = unixinput.c xdisplay.c -SRC_GEN =gen.c gen_dtmf.c gen_sin.c gen_zvei.c gen_hdlc.c costabi.c +SRC_GEN = gen.c gen_dtmf.c gen_sin.c gen_zvei.c gen_hdlc.c costabi.c -OBJ_L2 =$(SRC_L2:%.c=$(BINDIR)/%.o) -OBJ_L1 =$(SRC_L1:%.c=$(BINDIR)/%.o) -OBJ_MISC =$(SRC_MISC:%.c=$(BINDIR)/%.o) +OBJ_L2 = $(SRC_L2:%.c=$(BINDIR)/%.o) +OBJ_L1 = $(SRC_L1:%.c=$(BINDIR)/%.o) +OBJ_MISC = $(SRC_MISC:%.c=$(BINDIR)/%.o) -OBJ_GEN =$(SRC_GEN:%.c=$(BINDIR)/%.o) +OBJ_GEN = $(SRC_GEN:%.c=$(BINDIR)/%.o) $(BINDIR): $(MKDIR) $(BINDIR) @@ -108,14 +105,14 @@ $(BINDIR)/multimon: $(OBJ_L2) $(OBJ_L1) $(OBJ_MISC) @echo LD $@ $(Q)$(CC) $^ $(LDFLAGS) $(LDFLAGSX) -o $@ -$(BINDIR)/gen: $(OBJ_GEN) - $(CC) $^ $(LDFLAGS) -o $@ +$(BINDIR)/gen: $(OBJ_GEN) + $(CC) $^ $(LDFLAGS) -o $@ $(BINDIR)/mkcostab: $(BINDIR)/mkcostab.o - $(CC) $^ $(LDFLAGS) -o $@ + $(CC) $^ $(LDFLAGS) -o $@ costabi.c costabf.c: $(BINDIR)/mkcostab - $(BINDIR)/mkcostab + $(BINDIR)/mkcostab libtest: pprzlib.o demodml.c demod.ml test.ml @@ -133,11 +130,11 @@ hdlc.cmo : hdlc.cmi $(OCAMLC) $< clean: - rm -fr *.cm* mkcostab .depend - $(RM) -f core `find . -name '*.[oas]' -print` - $(RM) -f core `find . -name 'core' -print` - $(RM) -f core costabi.c costabf.c *~ - $(RM) $(BINDIR)/multimon + $(Q)rm -fr *.cm* mkcostab .depend + $(Q)$(RM) -f core `find . -name '*.[oas]' -print` *.so + $(Q)$(RM) -f core `find . -name 'core' -print` + $(Q)$(RM) -f core costabi.c costabf.c *~ + $(Q)$(RM) $(BINDIR)/multimon .PHONY: all clean depend dep diff --git a/sw/ground_segment/tmtc/GSM/Makefile b/sw/ground_segment/tmtc/GSM/Makefile index 697b8399d9..b4a17b6b54 100644 --- a/sw/ground_segment/tmtc/GSM/Makefile +++ b/sw/ground_segment/tmtc/GSM/Makefile @@ -1,7 +1,10 @@ +# Quiet compilation +Q=@ + all: SMS_GS SMS_GS: SMS_Ground_UDtest_final.c gcc -g -O2 -Wall `pkg-config --cflags glib-2.0 gtk+-2.0` -L/usr/lib -lglibivy -o SMS_GS SMS_Ground_UDtest_final.c `pkg-config --libs glib-2.0 gtk+-2.0` -lglibivy clean: - rm -f SMS_GS + $(Q)rm -f SMS_GS diff --git a/sw/ground_segment/tmtc/Makefile b/sw/ground_segment/tmtc/Makefile index 8449654b50..814ea6b996 100644 --- a/sw/ground_segment/tmtc/Makefile +++ b/sw/ground_segment/tmtc/Makefile @@ -32,23 +32,18 @@ endif include ../../../conf/Makefile.local +include ../../Makefile.ocaml CONF = ../../../conf VAR = ../../../var -OCAMLC = ocamlc -OCAMLOPT = ocamlopt -OCAMLDEP = ocamldep -LIBPPRZDIR = ../../lib/ocaml -OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) -OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring) -INCLUDES= -I $(LIBPPRZDIR) -I ../multimon $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) $(OCAMLNETINCLUDES) - -LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma -LIBPPRZCMXA=$(LIBPPRZCMA:.cma=.cmxa) -XLIBPPRZCMA=$(LIBPPRZDIR)/xlib-pprz.cma -XLIBPPRZCMXA=$(XLIBPPRZCMA:.cma=.cmxa) +INCLUDES= -I ../multimon +PKG = -package glibivy,pprz +LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz +XPKG = -package pprz.xlib +XLINKPKG = $(XPKG) -linkpkg -dllpath-pkg pprz.xlib LIBMULTIMONCMA=../multimon/multimon.cma +LIBMULTIMONDLL= multimon.cma -dllpath $(PAPARAZZI_SRC)/sw/ground_segment/multimon SERVERCMO = server_globals.cmo aircraft.cmo wind.cmo airprox.cmo kml.cmo fw_server.ml rotorcraft_server.ml server.cmo SERVERCMX = $(SERVERCMO:.cmo=.cmx) @@ -57,7 +52,7 @@ SERVERCMX = $(SERVERCMO:.cmo=.cmx) all: link server messages settings dia diadec $(VAR)/boa.conf ivy_tcp_aircraft ivy_tcp_controller broadcaster ivy2udp ivy_serial_bridge clean: - rm -f link server messages settings dia diadec *.bak *~ core *.o .depend *.opt *.out *.cm* ivy_tcp_aircraft ivy_tcp_controller broadcaster ivy2udp ivy_serial_bridge gpsd2ivy c_ivy_client_example_1 c_ivy_client_example_2 c_ivy_client_example_3 + $(Q)rm -f link server messages settings dia diadec *.bak *~ core *.o .depend *.opt *.out *.cm* ivy_tcp_aircraft ivy_tcp_controller broadcaster ivy2udp ivy_serial_bridge gpsd2ivy c_ivy_client_example_1 c_ivy_client_example_2 c_ivy_client_example_3 $(VAR)/boa.conf :$(CONF)/boa.conf @@ -65,77 +60,75 @@ $(VAR)/boa.conf :$(CONF)/boa.conf sed 's|PAPARAZZI_HOME|$(PAPARAZZI_HOME)|' < $< > $@ -messages : messages.cmo $(XLIBPPRZCMA) $(LIBPPRZCMA) +messages : messages.cmo @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma gtkInit.cmo $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gtkInit.cmo $< - -settings : settings.cmo $(XLIBPPRZCMA) $(LIBPPRZCMA) ../cockpit/page_settings.cmo +settings : settings.cmo ../cockpit/page_settings.cmo @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -I ../cockpit -o $@ unix.cma str.cma xml-light.cma lablgtk.cma lablglade.cma $(OCAMLNETCMA) glibivy-ocaml.cma lib-pprz.cma lablgnomecanvas.cma xlib-pprz.cma gtkInit.cmo gtk_save_settings.cmo saveSettings.cmo page_settings.cmo $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(XLINKPKG) gtkInit.cmo -I ../cockpit gtk_save_settings.cmo saveSettings.cmo page_settings.cmo $< - -server : $(SERVERCMO) $(LIBPPRZCMA) +server : $(SERVERCMO) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma $(SERVERCMO) + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $(SERVERCMO) -server.opt : $(SERVERCMX) $(LIBPPRZCMXA) +server.opt : $(SERVERCMX) @echo OOL $@ - $(Q)$(OCAMLOPT) $(INCLUDES) -o $@ str.cmxa unix.cmxa xml-light.cmxa lablgtk.cmxa glibivy-ocaml.cmxa lib-pprz.cmxa $(SERVERCMX) + $(Q)$(OCAMLOPT) $(INCLUDES) -o $@ -package glibivy,pprz -linkpkg $(SERVERCMX) -link : link.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) +link : link.cmo $(LIBMULTIMONCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $(LIBMULTIMONDLL) $< -ivy_tcp_aircraft : ivy_tcp_aircraft.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) +ivy_tcp_aircraft : ivy_tcp_aircraft.cmo $(LIBMULTIMONCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $(LIBMULTIMONDLL) $< -ivy_tcp_controller : ivy_tcp_controller.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) +ivy_tcp_controller : ivy_tcp_controller.cmo $(LIBMULTIMONCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $(LIBMULTIMONDLL) $< -broadcaster : broadcaster.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) +broadcaster : broadcaster.cmo $(LIBMULTIMONCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $(LIBMULTIMONDLL) $< -ivy2udp : ivy2udp.cmo $(LIBPPRZCMA) +ivy2udp : ivy2udp.cmo @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $< -dia : dia.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) +dia : dia.cmo $(LIBMULTIMONCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $(LIBMULTIMONDLL) $< -diadec : diadec.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) +diadec : diadec.cmo $(LIBMULTIMONCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $(LIBMULTIMONDLL) $< -150m : 150m.cmo $(LIBPPRZCMA) +150m : 150m.cmo @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma gtkInit.cmo $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gtkInit.cmo $< settings.cmo : INCLUDES += -I ../cockpit settings.cmo : ../cockpit/page_settings.cmi %.cmo : %.ml @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(INCLUDES) $(PKG) -c $< %.cmx : %.ml @echo OOC $< - $(Q)$(OCAMLOPT) $(INCLUDES) -c $< + $(Q)$(OCAMLOPT) $(INCLUDES) $(PKG) -c $< %.cmi : %.mli @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) $< + $(Q)$(OCAMLC) $(INCLUDES) $(PKG) $< CC = gcc diff --git a/sw/in_progress/button/Makefile b/sw/in_progress/button/Makefile index 73f653b0d5..bfec52d75c 100644 --- a/sw/in_progress/button/Makefile +++ b/sw/in_progress/button/Makefile @@ -27,10 +27,6 @@ OCAMLC = ocamlc OCAMLOPT = ocamlopt INCLUDES= $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format lablgtk2) -I ../../lib/ocaml -# default directory for temporary files -TMPDIR ?= /tmp - - all: panic $^ @@ -57,9 +53,19 @@ plot : ../../lib/ocaml/lib-pprz.cmxa export.cmo : gtk_export.cmo export.cmx : gtk_export.cmx +UNAME = $(shell uname -s) +ifeq ("$(UNAME)","Darwin") + MKTEMP = gmktemp +else + MKTEMP = mktemp +endif + gtk_export.ml : export.glade - grep -v invisible_char $< > $(TMPDIR)/$< - lablgladecc2 -root export -hide-default $(TMPDIR)/$< | grep -B 1000000 " end" > $@ + @echo GLADE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)grep -v invisible_char $< > $($@_TMP) + $(Q)lablgladecc2 -root export -hide-default $($@_TMP) | grep -B 1000000 " end" > $@ + $(Q)rm -f $($@_TMP) pt : ahrsview imuview ahrs2fg @@ -72,7 +78,7 @@ MORE_FLAGS = -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/incl MORE_CFLAGS = -DHAVE_DLFCN_H=1 -DSTDC_HEADERS=1 -I. -I. -I.. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include clean: - rm -f *.opt *.out *~ core *.o *.bak .depend *.cm* panic + $(Q)rm -f *.opt *.out *~ core *.o *.bak .depend *.cm* panic #FGFS_PREFIX=/home/poine/local FGFS_PREFIX=/home/poine/flightgear diff --git a/sw/in_progress/fdm/Makefile b/sw/in_progress/fdm/Makefile index 1589709003..265f34be4f 100644 --- a/sw/in_progress/fdm/Makefile +++ b/sw/in_progress/fdm/Makefile @@ -35,4 +35,4 @@ fms_steps_attitude: fms_steps_attitude.c clean: - rm -f *~ core *.o *.bak .depend fdm_step fms_steps_attitude + $(Q)rm -f *~ core *.o *.bak .depend fdm_step fms_steps_attitude diff --git a/sw/in_progress/inertial/C/Makefile b/sw/in_progress/inertial/C/Makefile index 2c893ed041..c0e8483ea6 100644 --- a/sw/in_progress/inertial/C/Makefile +++ b/sw/in_progress/inertial/C/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + CFLAGS = -g -Wall `pkg-config glib-2.0 --cflags` LDFLAGS = `pkg-config glib-2.0 --libs` -lm @@ -127,4 +130,4 @@ test_ukf: $(OBJS_TEST_UKF) clean: - rm -f *~ *.o tilt_ukf tilt_ekf tilt_fast_ekf ahrs_euler_ekf ahrs_quat_ukf ahrs_quat_ekf ahrs_quat_fast_ekf test_matrix test_ukf \ No newline at end of file + $(Q)rm -f *~ *.o tilt_ukf tilt_ekf tilt_fast_ekf ahrs_euler_ekf ahrs_quat_ukf ahrs_quat_ekf ahrs_quat_fast_ekf test_matrix test_ukf diff --git a/sw/in_progress/ir_calibration/Makefile b/sw/in_progress/ir_calibration/Makefile index 6924422e1d..662e015cf3 100644 --- a/sw/in_progress/ir_calibration/Makefile +++ b/sw/in_progress/ir_calibration/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + CC = gcc CFLAGS=-g -O2 -Wall `pkg-config gtk+-2.0 --cflags` @@ -8,4 +11,4 @@ ir_calib : main.c calibrator.c gui.c $(CC) $(CFLAGS) -g -o $@ $^ $(LDFLAGS) clean: - rm -f *~ ir_calib + $(Q)rm -f *~ ir_calib diff --git a/sw/in_progress/ir_usb_i2c/Makefile b/sw/in_progress/ir_usb_i2c/Makefile index ea917551d1..0de9eb6d92 100644 --- a/sw/in_progress/ir_usb_i2c/Makefile +++ b/sw/in_progress/ir_usb_i2c/Makefile @@ -2,12 +2,15 @@ # Makefile # +# Quiet compilation +Q=@ + APP = i2c_usb all: $(APP) clean: - rm -f $(APP) + $(Q)rm -f $(APP) $(APP): $(APP).c $(CC) -Wall -o $@ $(APP).c -lusb diff --git a/sw/in_progress/log_parser/Makefile b/sw/in_progress/log_parser/Makefile index 7461a91191..6c5e307a65 100644 --- a/sw/in_progress/log_parser/Makefile +++ b/sw/in_progress/log_parser/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + #LIBNAME = efsl APPNAME = linuxtest @@ -24,7 +27,7 @@ SOURCES = linuxtest.c all: $(APPNAME) clean: - $(RM) -f core $(APPNAME).o $(APPNAME) $(APPNAME).obj $(APPNAME).exe + $(Q)$(RM) -f core $(APPNAME).o $(APPNAME) $(APPNAME).obj $(APPNAME).exe app: $(APPNAME) diff --git a/sw/in_progress/motor_bench/Makefile b/sw/in_progress/motor_bench/Makefile index b08228faec..f103caabec 100644 --- a/sw/in_progress/motor_bench/Makefile +++ b/sw/in_progress/motor_bench/Makefile @@ -1,3 +1,6 @@ +# Quiet compilation +Q=@ + CC = gcc CFLAGS=-g -O2 -Wall `pkg-config gtk+-2.0 --cflags` -I../../../var/MB LDFLAGS=`pkg-config gtk+-2.0 --libs` -s -lglibivy @@ -13,5 +16,5 @@ plot_test: scilab -f test.sce -args $(LOG) clean: - rm -f *~ motor_bench + $(Q)rm -f *~ motor_bench diff --git a/sw/in_progress/satcom/Makefile b/sw/in_progress/satcom/Makefile index 0c780f676d..a45c21e257 100644 --- a/sw/in_progress/satcom/Makefile +++ b/sw/in_progress/satcom/Makefile @@ -1,3 +1,6 @@ +# Quiet compilation +Q=@ + all: email2udp udp2tcp tcp2ivy email2udp: email2udp.c @@ -10,4 +13,4 @@ tcp2ivy_generic: tcp2ivy_generic.c gcc -g -O2 -Wall `pkg-config glib-2.0 --cflags` -I../../../var/${AIRCRAFT} -o $@ $^ `pkg-config glib-2.0 --libs` -lglibivy -lm clean: - rm -f email2udp udp2tcp tcp2ivy + $(Q)rm -f email2udp udp2tcp tcp2ivy diff --git a/sw/in_progress/turbine/Makefile b/sw/in_progress/turbine/Makefile index 08d8029d5d..05f36c7856 100644 --- a/sw/in_progress/turbine/Makefile +++ b/sw/in_progress/turbine/Makefile @@ -1,11 +1,14 @@ +# Quiet compilation +Q=@ + CC=gcc MODCFLAGS=-Wall all: turb_simu clean: - rm -f core *.o turb_simu + $(Q)rm -f core *.o turb_simu ublox_conf: ublox_conf.c Makefile $(CC) $(MODCFLAGS) turb_simu.c -o turb_simu diff --git a/sw/in_progress/wind_tunnel/Makefile b/sw/in_progress/wind_tunnel/Makefile index 00d292d5b9..b96cb01933 100644 --- a/sw/in_progress/wind_tunnel/Makefile +++ b/sw/in_progress/wind_tunnel/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + CC = gcc GLIB_CFLAGS = -Wall `pkg-config glib-2.0 --cflags` GLIB_LDFLAGS = `pkg-config glib-2.0 --libs` -lglibivy -lpcre @@ -8,4 +11,4 @@ main: main.c serial_port.c clean: - rm -f main \ No newline at end of file + $(Q)rm -f main diff --git a/sw/lib/ocaml/META.pprz.deb b/sw/lib/ocaml/META.pprz.deb new file mode 100644 index 0000000000..766505fe9b --- /dev/null +++ b/sw/lib/ocaml/META.pprz.deb @@ -0,0 +1,14 @@ +description = "Paparazzi UAS package" +requires = "unix,str,xml-light,lablgtk2,glibivy,netclient" +version = "1.0" +directory = "" + +archive(byte) = "lib-pprz.cma" +archive(native) = "lib-pprz.cmxa" + +package "xlib" ( + requires = "pprz,lablgtk2-gnome.gnomecanvas,lablgtk2.glade" + version = "1.0" + archive(byte) = "xlib-pprz.cma" + archive(native) = "xlib-pprz.cmxa" +) diff --git a/sw/lib/ocaml/META.pprz.osx b/sw/lib/ocaml/META.pprz.osx new file mode 100644 index 0000000000..bd3c7b33ca --- /dev/null +++ b/sw/lib/ocaml/META.pprz.osx @@ -0,0 +1,14 @@ +description = "Paparazzi UAS package" +requires = "unix,str,xml-light,lablgtk2,glibivy,netclient" +version = "1.0" +directory = "" + +archive(byte) = "lib-pprz.cma" +archive(native) = "lib-pprz.cmxa" + +package "xlib" ( + requires = "pprz,lablgtk2.gnomecanvas,lablgtk2.glade" + version = "1.0" + archive(byte) = "xlib-pprz.cma" + archive(native) = "xlib-pprz.cmxa" +) diff --git a/sw/lib/ocaml/Makefile b/sw/lib/ocaml/Makefile index bf3adb718f..63bf561117 100644 --- a/sw/lib/ocaml/Makefile +++ b/sw/lib/ocaml/Makefile @@ -23,6 +23,19 @@ Q=@ + +OCAMLC=ocamlfind ocamlc +OCAMLOPT=ocamlfind ocamlopt +OCAMLDEP=ocamldep +OCAMLLEX=ocamllex +OCAMLYACC=ocamlyacc +OCAMLMKLIB=ocamlmklib +OCAMLLIBDIR=$(shell $(OCAMLC) -where) + +# verbose ocamlmklib: Print commands before executing them +#VERBOSITY = -verbose +VERBOSITY = + LBITS := $(shell getconf LONG_BIT) ifeq ($(LBITS),64) FPIC = -ccopt -fPIC @@ -30,15 +43,21 @@ else FPIC = endif -INCLUDES= $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) $(shell ocamlfind query -r -i-format pcre) -XINCLUDES= $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) -OCAMLC=ocamlc -OCAMLDEP=ocamldep -OCAMLOPT=ocamlopt -OCAMLLEX=ocamllex -OCAMLYACC=ocamlyacc -OCAMLLIBDIR=$(shell $(OCAMLC) -where) +UNAME = $(shell uname -s) +ifeq ("$(UNAME)","Darwin") + MKTEMP = gmktemp + LABLGTK2GNOMECANVAS = lablgtk2.gnomecanvas + METAFILE = META.pprz.osx +else + MKTEMP = mktemp + LABLGTK2GNOMECANVAS = lablgtk2-gnome.gnomecanvas + METAFILE = META.pprz.deb +endif +INCLUDES= +PKGCOMMON=xml-light,netclient,glibivy,lablgtk2 +XINCLUDES= +XPKGCOMMON=xml-light,glibivy,$(LABLGTK2GNOMECANVAS),lablgtk2.glade SRC = fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml maps_support.ml gm.ml iGN.ml geometry_2d.ml cserial.o convert.o ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml CMO = $(SRC:.ml=.cmo) @@ -51,30 +70,26 @@ XCMX = $(XSRC:.ml=.cmx) TESTS_SRC = test/test_latlong.ml TESTS_CMO = $(TESTS_SRC:.ml=.cmo) -# default directory for temporary files -TMPDIR ?= /tmp - -$(XCMO) $(XCMX) myGtkInit.cmo : INCLUDES=$(XINCLUDES) - -all : lib-pprz.cma xlib-pprz.cma myGtkInit.cmo xml_get.out opt -opt : lib-pprz.cmxa xlib-pprz.cmxa +all : byte native +byte : lib-pprz.cma xlib-pprz.cma myGtkInit.cmo xml_get.out META.pprz +native : lib-pprz.cmxa xlib-pprz.cmxa META.pprz lib-pprz.cma liblib-pprz.a: $(CMO) @echo OL $@ - $(Q)ocamlmklib $(INCLUDES) -o lib-pprz $^ + $(Q)$(OCAMLMKLIB) $(VERBOSITY) $(INCLUDES) -o lib-pprz $^ lib-pprz.cmxa dlllib-pprz.so: $(CMX) @echo OOL $@ - $(Q)ocamlmklib $(INCLUDES) -o lib-pprz $^ + $(Q)$(OCAMLMKLIB) $(VERBOSITY) $(INCLUDES) -o lib-pprz $^ xlib-pprz.cma libxlib-pprz.a: $(XCMO) @echo OL $@ - $(Q)ocamlmklib $(XINCLUDES) -o xlib-pprz $^ + $(Q)$(OCAMLMKLIB) $(VERBOSITY) $(XINCLUDES) -o xlib-pprz $^ xlib-pprz.cmxa dllxlib-pprz.so: $(XCMX) @echo OOL $@ - $(Q)ocamlmklib $(XINCLUDES) -o xlib-pprz $^ + $(Q)$(OCAMLMKLIB) $(VERBOSITY) $(XINCLUDES) -o xlib-pprz $^ # trying to set correct dependencies for parallel build # these are order only depedencies @@ -82,50 +97,46 @@ lib-pprz.cmxa: | liblib-pprz.a dlllib-pprz.so xlib-pprz.cmxa: | libxlib-pprz.a dllxlib-pprz.so -xml_get.out : lib-pprz.cma xml_get.cmo | opt +xml_get.out : lib-pprz.cma xml_get.cmo @echo OL $@ - $(Q)$(OCAMLC) $(INCLUDES) -o $@ str.cma xml-light.cma -I . $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ -package str,xml-light -linkpkg -I . $^ tests : lib-pprz.cma $(TESTS_CMO) - $(OCAMLC) $(INCLUDES) -custom -I . -o $@ str.cma unix.cma ivy-ocaml.cma xml-light.cma $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ -package unix,str,xml-light,ivy -linkpkg -I . -dllpath . $^ -GTKCFLAGS := `pkg-config --cflags gtk+-2.0` -#GTKCFLAGS := -I/usr/lib/gtk-2.0/include -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo -# GTKCFLAGS := $(shell gtk-config --cflags) - -%.o : %.c +%.o : %.c @echo OC $< - $(Q)$(OCAMLC) $(FPIC) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(FPIC) $(INCLUDES) -package $(PKGCOMMON) -c $< +$(XCMO) $(XCMX) myGtkInit.cmo : PKGCOMMON=$(XPKGCOMMON) + + +GTKCFLAGS := $(shell pkg-config --cflags gtk+-2.0) ml_gtk_drag.o : ml_gtk_drag.c @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) -c -ccopt "$(GTKCFLAGS)" $< + $(Q)$(OCAMLC) $(INCLUDES) -package $(PKGCOMMON) -c -ccopt "$(GTKCFLAGS)" $< -ml_gtkgl_hack.o : ml_gtkgl_hack.c +ml_gtkgl_hack.o : ml_gtkgl_hack.c @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) -c -ccopt "$(GTKCFLAGS)" $< + $(Q)$(OCAMLC) $(INCLUDES) -package $(PKGCOMMON) -c -ccopt "$(GTKCFLAGS)" $< camltm.o : register_example.cmo - $(OCAMLC) $(INCLUDES) -output-obj -o $@ unix.cma str.cma xml-light.cma ivy-ocaml.cma debug.cmo serial.cmo extXml.cmo env.cmo pprz.cmo tm.cmo + $(OCAMLC) $(INCLUDES) -output-obj -o $@ -package unix,str,xml-light,ivy debug.cmo serial.cmo extXml.cmo env.cmo pprz.cmo tm.cmo caml_from_c_example : cserial.o convert.o caml_from_c_example.o camltm.o $(CC) -o $@ $^ -L$(OCAMLLIBDIR) -lunix -lstr -livy-ocaml -lcamlrun -lm -livy -lcurses %.cmo : %.ml @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(INCLUDES) -package $(PKGCOMMON) -c $< %.cmx : %.ml @echo OOC $< - $(Q)$(OCAMLOPT) $(INCLUDES) -c $< + $(Q)$(OCAMLOPT) $(INCLUDES) -package $(PKGCOMMON) -c $< %.cmi : %.mli @echo OC $< - $(Q)$(OCAMLC) $(XINCLUDES) $(INCLUDES) $< - -%.cmi : %.ml - @echo OC $< - $(Q)$(OCAMLC) $(XINCLUDES) -c $< + $(Q)$(OCAMLC) $(XINCLUDES) $(INCLUDES) -package $(PKGCOMMON),$(XPKGCOMMON) $< %.ml : %.mll @echo OCL $< @@ -135,6 +146,8 @@ caml_from_c_example : cserial.o convert.o caml_from_c_example.o camltm.o @echo OCY $< $(Q)$(OCAMLYACC) $< +# dependencies not covered by ocamldep +# since these files are generated expr_parser.cmo expr_parser.cmx : expr_parser.cmi expr_syntax.cmi expr_parser.cmi : expr_parser.ml expr_syntax.cmi expr_lexer.ml : expr_parser.ml @@ -142,31 +155,42 @@ expr_lexer.cmi : expr_lexer.ml expr_syntax.cmi expr_lexer.cmo : expr_lexer.cmi expr_syntax.cmo : expr_syntax.cmi - gtk_papget_editor.ml : widgets.glade - grep -v invisible_char $< > $(TMPDIR)/$@_$< - lablgladecc2 -root papget_editor -hide-default $(TMPDIR)/$@_$< | grep -B 1000000 " end" > $@ - @rm $(TMPDIR)/$@_$< + @echo GLADE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)grep -v invisible_char $< > $($@_TMP) + $(Q)lablgladecc2 -root papget_editor -hide-default $($@_TMP) | grep -B 1000000 " end" > $@ + $(Q)rm -f $($@_TMP) gtk_papget_text_editor.ml : widgets.glade - grep -v invisible_char $< > $(TMPDIR)/$@_$< - lablgladecc2 -root table_text_editor -hide-default $(TMPDIR)/$@_$< | grep -B 1000000 " end" > $@ - @rm $(TMPDIR)/$@_$< + @echo GLADE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)grep -v invisible_char $< > $($@_TMP) + $(Q)lablgladecc2 -root table_text_editor -hide-default $($@_TMP) | grep -B 1000000 " end" > $@ + $(Q)rm -f $($@_TMP) gtk_papget_gauge_editor.ml : widgets.glade - grep -v invisible_char $< > $(TMPDIR)/$@_$< - lablgladecc2 -root table_gauge_editor -hide-default $(TMPDIR)/$@_$< | grep -B 1000000 " end" > $@ - @rm $(TMPDIR)/$@_$< + @echo GLADE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)grep -v invisible_char $< > $($@_TMP) + $(Q)lablgladecc2 -root table_gauge_editor -hide-default $($@_TMP) | grep -B 1000000 " end" > $@ + $(Q)rm -f $($@_TMP) gtk_papget_led_editor.ml : widgets.glade - grep -v invisible_char $< > $(TMPDIR)/$@_$< - lablgladecc2 -root table_led_editor -hide-default $(TMPDIR)/$@_$< | grep -B 1000000 " end" > $@ - @rm $(TMPDIR)/$@_$< + @echo GLADE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)grep -v invisible_char $< > $($@_TMP) + $(Q)$(Q)lablgladecc2 -root table_led_editor -hide-default $($@_TMP) | grep -B 1000000 " end" > $@ + $(Q)rm -f $($@_TMP) + +META.pprz : $(METAFILE) + @echo COPY $< + $(shell cp $< META.pprz) clean : - rm -f *~ *.cm* *.out *.opt .depend *.a *.o *.so caml_from_c_example tests gtk_papget_*.ml expr_parser.ml expr_parser.mli expr_lexer.ml expr_lexer.mli + $(Q)rm -f *~ *.cm* *.out *.opt .depend *.a *.o *.so caml_from_c_example tests gtk_papget_*.ml expr_parser.ml expr_parser.mli expr_lexer.ml expr_lexer.mli META.pprz -.PHONY: all opt clean +.PHONY: all byte native clean # # Dependencies diff --git a/sw/logalizer/Makefile b/sw/logalizer/Makefile index 5b719da7df..61fbc6e9e6 100644 --- a/sw/logalizer/Makefile +++ b/sw/logalizer/Makefile @@ -23,52 +23,42 @@ # Quiet compilation Q=@ -OCAMLC = ocamlc -OCAMLDEP = ocamldep -OCAMLOPT = ocamlopt -LIBPPRZDIR = ../lib/ocaml -INCLUDES= $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format lablgtk2) -I $(LIBPPRZDIR) -LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma -LIBPPRZCMXA=$(LIBPPRZCMA:.cma=.cmxa) -XLIBPPRZCMA=$(LIBPPRZDIR)/xlib-pprz.cma -XLIBPPRZCMXA=$(XLIBPPRZCMA:.cma=.cmxa) - -# default directory for temporary files -TMPDIR ?= /tmp +include ../Makefile.ocaml +INCLUDES= +PKG = -package glibivy,pprz +LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz +XPKG = -package pprz.xlib +XLINKPKG = $(XPKG) -linkpkg -dllpath-pkg pprz.xlib all: play plotter plot sd2log plotprofile openlog2tlm play : log_file.cmo play_core.cmo play.cmo @echo OL $@ - $(Q)$(OCAMLC) $(INCLUDES) -custom -o $@ unix.cma str.cma xml-light.cma glibivy-ocaml.cma $(shell ocamlfind query -r -i-format lablgtk2) -I ../lib/ocaml lablgtk.cma lib-pprz.cma gtkInit.cmo $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gtkInit.cmo $^ play-nox : play_core.cmo play-nox.cmo @echo OL $@ - $(Q)$(OCAMLC) $(INCLUDES) -custom -o $@ unix.cma str.cma xml-light.cma glibivy-ocaml.cma $(shell ocamlfind query -r -i-format lablgtk2) -I ../lib/ocaml lablgtk.cma lib-pprz.cma $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $^ plotter : plotter.cmo @echo OL $@ - $(Q)$(OCAMLC) $(INCLUDES) -custom -o $@ unix.cma str.cma xml-light.cma glibivy-ocaml.cma lablgtk.cma lib-pprz.cma xlib-pprz.cma gtkInit.cmo $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(XLINKPKG) gtkInit.cmo $^ -plot : log_file.cmx gtk_export.cmx export.cmx plot.cmx +plot : log_file.cmo gtk_export.cmo export.cmo plot.cmo @echo OL $@ - $(Q)$(OCAMLOPT) $(INCLUDES) -o $@ unix.cmxa str.cmxa xml-light.cmxa glibivy-ocaml.cmxa lablgtk.cmxa lib-pprz.cmxa xlib-pprz.cmxa lablglade.cmxa gtkInit.cmx $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(XLINKPKG) gtkInit.cmo $^ sd2log : sd2log.cmo @echo OL $@ - $(Q)$(OCAMLC) $(INCLUDES) -custom -o $@ unix.cma str.cma xml-light.cma glibivy-ocaml.cma lib-pprz.cma $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $^ CC = gcc CFLAGS=-g -O2 -Wall LDFLAGS= openlog2tlm: openlog2tlm.c - $(CC) $(CFLAGS) -g -o $@ $^ - -# depedency on lib-pprz -play play-nox sd2log : $(LIBPPRZCMA) -plotter : $(LIBPPRZCMA) $(XLIBPPRZCMA) -plot : $(LIBPPRZCMXA) $(XLIBPPRZCMXA) + @echo CC $@ + $(Q)$(CC) $(CFLAGS) -g -o $@ $^ # Target for bytecode executable (if ocamlopt is not available) # plot : log_file.cmo gtk_export.cmo export.cmo plot.cmo @@ -77,21 +67,30 @@ plot : $(LIBPPRZCMXA) $(XLIBPPRZCMXA) %.cmo: %.ml @echo OC $< - $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) -c $(PKG) $< %.cmi: %.mli @echo OCI $< - $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) -c $(PKG) $< %.cmx: %.ml @echo OOC $< - $(Q)$(OCAMLOPT) $(OCAMLCFLAGS) $(INCLUDES) -c $< + $(Q)$(OCAMLOPT) $(OCAMLCFLAGS) $(INCLUDES) -c $(PKG) $< export.cmo : gtk_export.cmo export.cmx : gtk_export.cmx -gtk_export.ml : export.glade - grep -v invisible_char $< > $(TMPDIR)/$< - lablgladecc2 -root export -hide-default $(TMPDIR)/$< | grep -B 1000000 " end" > $@ +UNAME = $(shell uname -s) +ifeq ("$(UNAME)","Darwin") + MKTEMP = gmktemp +else + MKTEMP = mktemp +endif +gtk_export.ml : export.glade + @echo GLADE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)grep -v invisible_char $< > $($@_TMP) + $(Q)lablgladecc2 -root export -hide-default $($@_TMP) | grep -B 1000000 " end" > $@ + $(Q)rm -f $($@_TMP) pt : ahrsview imuview ahrs2fg @@ -128,16 +127,20 @@ MORE_FLAGS = -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/incl MORE_CFLAGS = -DHAVE_DLFCN_H=1 -DSTDC_HEADERS=1 -I. -I. -I.. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include disp3d: disp3d.c - $(CC) $(MORE_CFLAGS) -g -o $@ $^ $(MORE_FLAGS) + @echo CC $@ + $(Q)$(CC) $(MORE_CFLAGS) -g -o $@ $^ $(MORE_FLAGS) plotprofile: plotprofile.c - $(CC) $(IVY_C_LIBRARYS) $(IVY_C_INCLUDES) -g -O2 -Wall `pkg-config glib-2.0 --cflags` -o $@ $^ `pkg-config glib-2.0 --libs` -lglibivy + @echo CC $@ + $(Q)$(CC) $(IVY_C_LIBRARYS) $(IVY_C_INCLUDES) -g -O2 -Wall `pkg-config glib-2.0 --cflags` -o $@ $^ `pkg-config glib-2.0 --libs` -lglibivy test1: test1.c - $(CC) $(MORE_CFLAGS) -g -o $@ $^ $(MORE_FLAGS) -lglut + @echo CC $@ + $(Q)$(CC) $(MORE_CFLAGS) -g -o $@ $^ $(MORE_FLAGS) -lglut test3: test3.c sliding_plot.c - $(CC) $(CFLAGS) -g -o $@ $^ $(LDFLAGS) + @echo CC $@ + $(Q)$(CC) $(CFLAGS) -g -o $@ $^ $(LDFLAGS) #FGFS_PREFIX=/home/poine/local @@ -188,7 +191,7 @@ ctrlstick: ctrlstick.c $(CC) -g -O2 -Wall `pkg-config glib-2.0 --cflags` -o $@ $^ `pkg-config glib-2.0 --libs` -lglibivy clean: - rm -f *.opt *.out *~ core *.o *.bak .depend *.cm* play ahrsview imuview ahrs2fg plot plotter gtk_export.ml openlog2tlm disp3d plotprofile test1 test3 test_samere ivy_example tmclient ffjoystick ctrlstick sd2log motor_bench + $(Q)rm -f *.opt *.out *~ core *.o *.bak .depend *.cm* play ahrsview imuview ahrs2fg plot plotter gtk_export.ml openlog2tlm disp3d plotprofile test1 test3 test_samere ivy_example tmclient ffjoystick ctrlstick sd2log motor_bench .PHONY: all clean pt run_fg @@ -197,7 +200,7 @@ clean: # .depend: Makefile - ocamldep -I $(LIBPPRZDIR) *.ml* > .depend + $(OCAMLDEP) -I $(LIBPPRZDIR) *.ml* > .depend ifneq ($(MAKECMDGOALS),clean) -include .depend diff --git a/sw/logalizer/matlab/Makefile b/sw/logalizer/matlab/Makefile index 8d25b837bc..209d0dac42 100644 --- a/sw/logalizer/matlab/Makefile +++ b/sw/logalizer/matlab/Makefile @@ -1,2 +1,5 @@ +# Quiet compilation +Q=@ + clean: - rm -f *~ + $(Q)rm -f *~ diff --git a/sw/simulator/Makefile b/sw/simulator/Makefile index d80a46552d..8875deef01 100644 --- a/sw/simulator/Makefile +++ b/sw/simulator/Makefile @@ -24,12 +24,18 @@ Q=@ LBITS := $(shell getconf LONG_BIT) ifeq ($(LBITS),64) - FPIC = -ccopt -fPIC + FPIC = -fPIC else FPIC = endif include ../../conf/Makefile.local +include ../Makefile.ocaml + +OCAMLC += -g +INCLUDES = +PKG = -package glibivy,pprz +LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz SIMML = stdlib.ml data.ml flightModel.ml gps.ml SIMHML = $(SIMML) hitl.ml sim.ml @@ -38,63 +44,62 @@ SIMSML = $(SIMML) sitl.ml sim.ml SIMSCMO=$(SIMSML:%.ml=%.cmo) SIMSCMX=$(SIMSML:%.ml=%.cmx) - -OCAMLC = ocamlc -g -OCAMLOPT = ocamlopt -OCAMLDEP = ocamldep -OCAML=$(shell which ocaml) -OCAMLRUN=$(shell which ocamlrun) -LIBPPRZDIR=../lib/ocaml -INCLUDES= $(shell ocamlfind query -r -i-format lablgtk2) -I $(LIBPPRZDIR) $(shell ocamlfind query -r -i-format xml-light) -LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma - AIRBORNE = ../airborne VARINCLUDE=$(PAPARAZZI_HOME)/var/include ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT) +UNAME = $(shell uname -s) +ifeq ("$(UNAME)","Darwin") + CAML_CFLAGS = -I/opt/local/lib/ocaml +else + CAML_CFLAGS = +endif + all : gaia sitl.cma simhitl -simhitl : fg.o $(SIMHCMO) simhitl.cmo +fg.so : fg.o + @echo BUILD $@ + $(Q)$(CC) -shared -o $@ $^ + +simhitl : fg.so $(SIMHCMO) simhitl.cmo @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ str.cma xml-light.cma unix.cma glibivy-ocaml.cma lib-pprz.cma lablgtk.cma gtkInit.cmo $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gtkInit.cmo $< sitl.cma : fg.o $(SIMSCMO) @echo OL $@ - $(Q)ocamlmklib -o sitl $^ + $(Q)$(OCAMLMKLIB) -o sitl $^ sitl.cmxa : $(SIMSCMX) - ocamlopt -o $@ -a $^ + @echo OC $@ + $(Q)$(OCAMLOPT) -o $@ -a $^ gaia : gaia.cmo @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma glibivy-ocaml.cma lib-pprz.cma lablgtk.cma gtkInit.cmo $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gtkInit.cmo $< diffusion : stdlib.cmo diffusion.cmo @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma glibivy-ocaml.cma lib-pprz.cma lablgtk.cma gtkInit.cmo $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gtkInit.cmo $^ %.cmo : %.ml @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(INCLUDES) -c $(PKG) $< %.o : %.c - @echo OC $< - $(Q)$(OCAMLC) $(FPIC) -c $< + @echo CC $< + $(Q)$(CC) $(FPIC) -c $< $(CAML_CFLAGS) %.cmx : %.ml @echo OOC $< - $(Q)$(OCAMLOPT) $(INCLUDES) -c $< + $(Q)$(OCAMLOPT) $(INCLUDES) -c $(PKG) $< %.cmi : %.mli @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) -c $< - -# dependency on lib-pprz -simhitl diffusion gaia: $(LIBPPRZCMA) + $(Q)$(OCAMLC) $(INCLUDES) -c $(PKG) $< clean : - rm -f *.cm* *~ *.out .depend *.o *.a *.so gaia simhitl diffusion + $(Q)rm -f *.cm* *~ *.out .depend *.o *.a *.so gaia simhitl diffusion .PHONY: all clean diff --git a/sw/simulator/old_booz/tests/Makefile b/sw/simulator/old_booz/tests/Makefile index eb7ed64047..4fbd86e779 100644 --- a/sw/simulator/old_booz/tests/Makefile +++ b/sw/simulator/old_booz/tests/Makefile @@ -3,6 +3,8 @@ # #JSBSIM = /usr/local +Q=@ + #CC = g++ #CFLAGS = -Wall -I$(JSBSIM)/include/JSBSim -I../include #LDFLAGS = -L$(JSBSIM)/lib -lJSBSim @@ -70,4 +72,5 @@ test_sensors : $(TEST_SENSORS_SRCS) gcc $(CFLAGS) -o $@ $^ $(LDFLAGS) clean: + $(Q)rm -f *.o diff --git a/sw/simulator/scilab/q3d/Makefile b/sw/simulator/scilab/q3d/Makefile index 0fcfc631b1..006ed84ac5 100644 --- a/sw/simulator/scilab/q3d/Makefile +++ b/sw/simulator/scilab/q3d/Makefile @@ -1,4 +1,7 @@ +# Quiet compilation +Q=@ + @@ -7,4 +10,4 @@ out.mpg: ffmpeg -f image2 -i images/frame_%04d.ppm out.mpg clean: - rm -f *~ \#*\# \ No newline at end of file + $(Q)rm -f *~ \#*\# diff --git a/sw/simulator/scilab/q3d/fonts/Makefile b/sw/simulator/scilab/q3d/fonts/Makefile index f99fbddd80..366ca57185 100644 --- a/sw/simulator/scilab/q3d/fonts/Makefile +++ b/sw/simulator/scilab/q3d/fonts/Makefile @@ -1,3 +1,6 @@ +# Quiet compilation +Q=@ + CC = gcc GLIB_CFLAGS = -Wall `pkg-config glib-2.0 --cflags` GLIB_LDFLAGS = `pkg-config glib-2.0 --libs` -lglibivy -lpcre @@ -6,5 +9,5 @@ ttx2scilab: ttx2scilab.c $(CC) -Wall $(GLIB_CFLAGS) -o $@ $< $(GLIB_LDFLAGS) clean: - rm -f ttx2scilab + $(Q)rm -f ttx2scilab diff --git a/sw/simulator/scilab/q3d/povray/Makefile b/sw/simulator/scilab/q3d/povray/Makefile index 2d511221a7..96349617b7 100644 --- a/sw/simulator/scilab/q3d/povray/Makefile +++ b/sw/simulator/scilab/q3d/povray/Makefile @@ -1,2 +1,5 @@ +# Quiet compilation +Q=@ + clean: - rm -f *~ foo*.png test.avi q3d.pov \ No newline at end of file + $(Q)rm -f *~ foo*.png test.avi q3d.pov diff --git a/sw/simulator/scilab/q6d/povray/Makefile b/sw/simulator/scilab/q6d/povray/Makefile index f799787b8a..2e0f53adbc 100644 --- a/sw/simulator/scilab/q6d/povray/Makefile +++ b/sw/simulator/scilab/q6d/povray/Makefile @@ -1,5 +1,8 @@ +# Quiet compilation +Q=@ + test: povray test.pov +Oimg001.png Display=false +W800 +H600 +Q9 +A0.3 +R5 clean: - rm -f *~ img*.png test.avi q3d.pov + $(Q)rm -f *~ img*.png test.avi q3d.pov diff --git a/sw/supervision/Makefile b/sw/supervision/Makefile index 18c8756e2a..68165d050b 100644 --- a/sw/supervision/Makefile +++ b/sw/supervision/Makefile @@ -23,45 +23,57 @@ # Launch with "make Q=''" to get full echo Q=@ -OCAMLC = ocamlc -OCAMLOPT = ocamlopt -OCAMLDEP = ocamldep -LIBPPRZDIR = ../lib/ocaml -INCLUDES= -I $(LIBPPRZDIR) $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) -LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma -PAPARAZZICENTERCMO = gtk_pc.cmo gtk_process.cmo pc_common.cmo pc_aircraft.cmo pc_control_panel.cmo paparazzicenter.cmo +include ../Makefile.ocaml -# default directory for temporary files -TMPDIR ?= /tmp +UNAME = $(shell uname -s) +ifeq ("$(UNAME)","Darwin") + MKTEMP = gmktemp + LABLGTK2GNOMEUI = lablgtk2.gnomeui +else + MKTEMP = mktemp + LABLGTK2GNOMEUI = lablgtk2-gnome.gnomeui +endif + +INCLUDES = +XPKG = -package pprz.xlib,$(LABLGTK2GNOMEUI) +XLINKPKG = $(XPKG) -linkpkg -dllpath-pkg pprz.xlib + +PAPARAZZICENTERCMO = gtk_pc.cmo gtk_process.cmo pc_common.cmo pc_aircraft.cmo pc_control_panel.cmo paparazzicenter.cmo all: paparazzicenter -paparazzicenter : $(PAPARAZZICENTERCMO) $(LIBPPRZDIR)/lib-pprz.cma +paparazzicenter : $(PAPARAZZICENTERCMO) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma lablglade.cma gtkInit.cmo lib-pprz.cma xlib-pprz.cma lablgnomeui.cma $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(XLINKPKG) gtkInit.cmo $^ gtk_pc.ml : paparazzicenter.glade - grep -v invisible_char $< > $(TMPDIR)/$< - lablgladecc2 -hide-default -root window $(TMPDIR)/$< > $@ + @echo GLADE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)grep -v invisible_char $< > $($@_TMP) + $(Q)lablgladecc2 -hide-default -root window $($@_TMP) > $@ + $(Q)rm -f $($@_TMP) gtk_process.ml : paparazzicenter.glade - grep -v invisible_char $< > $(TMPDIR)/$< - lablgladecc2 -hide-default -root hbox_program $(TMPDIR)/$< | grep -B 1000000 " end" > $@ + @echo GLADE $@ + $(eval $@_TMP := $(shell $(MKTEMP))) + $(Q)grep -v invisible_char $< > $($@_TMP) + $(Q)lablgladecc2 -hide-default -root hbox_program $($@_TMP) | grep -B 1000000 " end" > $@ + $(Q)rm -f $($@_TMP) %.cmo : %.ml @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) -c $< + $(Q)$(OCAMLC) $(INCLUDES) -c $(XPKG) $< %.cmi : %.mli @echo OC $< - $(Q)$(OCAMLC) $(INCLUDES) $< + $(Q)$(OCAMLC) $(INCLUDES) -c $(XPKG) $< pc_common.cmo: gtk_process.cmo paparazzicenter.cmo : gtk_pc.cmo clean: - \rm -f *.cm* gtk_pc.ml gtk_process.ml .depend paparazzicenter + $(Q)rm -f *.cm* gtk_pc.ml gtk_process.ml .depend paparazzicenter .PHONY: all clean diff --git a/sw/tools/Makefile b/sw/tools/Makefile index ec51976748..843326d1e2 100644 --- a/sw/tools/Makefile +++ b/sw/tools/Makefile @@ -22,16 +22,11 @@ # Quiet compilation Q=@ -OCAML=ocaml -OCAMLFIND=ocamlfind -OCAMLC=ocamlc -OCAMLDEP=ocamldep -LIBPPRZDIR=../lib/ocaml -INCLUDES=-I $(LIBPPRZDIR) -# $(shell ocamlfind query -r -i-format xml-light) -#OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) -#OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring) $(shell ocamlfind query -r -a-format -predicates byte netclient) -LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma +include ../Makefile.ocaml + +INCLUDES = +PKG = -package pprz +LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz all: gen_common.cmo gen_aircraft.out gen_airframe.out gen_messages2.out gen_messages.out gen_ubx.out gen_mtk.out gen_flight_plan.out gen_radio.out gen_periodic.out gen_settings.out gen_xsens.out gen_modules.out gen_autopilot.out gen_abi.out find_free_msg_id.out gen_srtm.out mergelogs @@ -40,37 +35,29 @@ ABS_FP = $(FP_CMO:%=$$PAPARAZZI_SRC/sw/tools/%) gen_flight_plan.out : $(FP_CMO) @echo OL $@ - $(Q)$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -custom -o $@ -package unix,str,xml-light -linkpkg ivy-ocaml.cma lib-pprz.cma $^ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $^ -gen_srtm.out : gen_srtm.ml gen_common.cmo $(LIBPPRZCMA) - @echo OC $@ - $(Q)$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -custom -o $@ -package unix,str,xml-light,netclient -linkpkg ivy-ocaml.cma lib-pprz.cma $< +gen_srtm.out : gen_srtm.ml + @echo OL $@ + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $< -%.out : %.ml gen_common.cmo $(LIBPPRZCMA) - @echo OC $< - $(Q)$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -custom -o $@ -package unix,str,xml-light -linkpkg ivy-ocaml.cma lib-pprz.cma gen_common.cmo $< - -# disable this for now and use the compiled bytecode -#@cat ../../pprz_src_test.sh > $@ -#@echo '$(OCAML) -I $$PAPARAZZI_SRC/sw/tools $(OCAMLNETINCLUDES) -I $$PAPARAZZI_SRC/sw/lib/ocaml unix.cma str.cma ivy-ocaml.cma xml-light.cma $(OCAMLNETCMA) lib-pprz.cma gen_common.cmo $$PAPARAZZI_BIN/$< $$*' >> $@ -#@chmod a+x $@ +%.out : %.ml gen_common.cmo + @echo OL $< + $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gen_common.cmo $< %.cmo : %.ml @echo OC $< - $(Q)$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -package xml-light -c $< + $(Q)$(OCAMLC) $(INCLUDES) $(PKG) -c $< %.cmi : %.mli @echo OC $< - $(Q)$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -package xml-light -c $< - -# dependency on lib-pprz -gen_flight_plan.out gen_srtm.out : $(LIBPPRZCMA) + $(Q)$(OCAMLC) $(INCLUDES) $(PKG) -c $< mergelogs: mergelogs.c gcc mergelogs.c -o mergelogs clean: - rm -f *.cm* *.out *~ .depend fp_parser.ml fp_parser.mli mergelogs + $(Q)rm -f *.cm* *.out *~ .depend fp_parser.ml fp_parser.mli mergelogs .PHONY: all clean diff --git a/sw/tools/wiki_gen/Makefile b/sw/tools/wiki_gen/Makefile index 766bb4b561..3bae53e3d4 100644 --- a/sw/tools/wiki_gen/Makefile +++ b/sw/tools/wiki_gen/Makefile @@ -46,4 +46,4 @@ OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring) $(Q)$(OCAMLYACC) $< clean: - rm -f *.cm* *.out *~ + $(Q)rm -f *.cm* *.out *~ diff --git a/tests/Makefile b/tests/Makefile index bdbbfa35c6..a06af1922a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -28,5 +28,5 @@ test: $(Q)$(PERLENV) $(PERL) "-e" "$(RUNTESTS)" clean: - rm -rf results/* + $(Q)rm -rf results/*