From 8bff1b46c9b4d3f0f711266363ac314901e470f5 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Fri, 9 Nov 2012 18:12:53 +0100 Subject: [PATCH] [build system] clean up makefiles and fix dependencies, parallel build with make -j 8 seems to work now --- Makefile | 210 +++++++++++++------------ Makefile.ac | 5 +- Makefile.lpctools | 35 +++++ conf/Makefile.geode | 17 +- conf/Makefile.jsbsim | 1 - conf/Makefile.local | 2 + conf/Makefile.lpc21 | 1 - conf/Makefile.nps | 1 + conf/Makefile.omap | 1 - conf/Makefile.pentium-m | 1 - conf/Makefile.sim | 2 +- conf/Makefile.stm32 | 6 +- data/maps/Makefile | 25 ++- sw/airborne/arch/lpc21/lpcusb/Makefile | 30 +++- sw/ext/Makefile | 20 +-- sw/ground_segment/cockpit/Makefile | 17 +- sw/ground_segment/joystick/Makefile | 26 ++- sw/ground_segment/lpc21iap/Makefile | 2 + sw/ground_segment/misc/Makefile | 35 ++++- sw/ground_segment/multimon/Makefile | 26 ++- sw/ground_segment/tmtc/Makefile | 73 +++++---- sw/lib/ocaml/Makefile | 7 +- sw/logalizer/Makefile | 23 ++- sw/simulator/Makefile | 31 ++-- sw/supervision/Makefile | 43 +++-- sw/tools/Makefile | 49 +++--- 26 files changed, 444 insertions(+), 245 deletions(-) create mode 100644 Makefile.lpctools diff --git a/Makefile b/Makefile index ff963faecf..6d8ba02662 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- # -# Paparazzi main $Id$ # Copyright (C) 2004 Pascal Brisset Antoine Drouin # # This file is part of paparazzi. @@ -38,18 +37,49 @@ ifeq ($(PAPARAZZI_HOME),) PAPARAZZI_HOME=$(PAPARAZZI_SRC) endif +# export the PAPARAZZI environment to sub-make +export PAPARAZZI_SRC +export PAPARAZZI_HOME + +OCAML=$(shell which ocaml) +OCAMLRUN=$(shell which ocamlrun) +BUILD_DATETIME:=$(shell date +%Y%m%d-%H%M%S) + +# +# define some paths +# LIB=sw/lib +STATICINCLUDE =$(PAPARAZZI_HOME)/var/include +CONF=$(PAPARAZZI_SRC)/conf AIRBORNE=sw/airborne +SIMULATOR=sw/simulator +MULTIMON=sw/ground_segment/multimon COCKPIT=sw/ground_segment/cockpit TMTC=sw/ground_segment/tmtc -MULTIMON=sw/ground_segment/multimon +TOOLS=$(PAPARAZZI_SRC)/sw/tools +EXT=sw/ext + +# +# build some stuff in subdirs +# nothing should depend on these... +# +PPRZCENTER=sw/supervision MISC=sw/ground_segment/misc LOGALIZER=sw/logalizer -SIMULATOR=sw/simulator -EXT=sw/ext -MAKE=make PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) -CONF=$(PAPARAZZI_SRC)/conf -STATICINCLUDE =$(PAPARAZZI_HOME)/var/include + +SUBDIRS = $(PPRZCENTER) $(MISC) $(LOGALIZER) + +# +# xml files used as input for header generation +# +MESSAGES_XML = $(CONF)/messages.xml +UBX_XML = $(CONF)/ubx.xml +MTK_XML = $(CONF)/mtk.xml +XSENS_XML = $(CONF)/xsens_MTi-G.xml + +# +# generated header files +# MESSAGES_H=$(STATICINCLUDE)/messages.h MESSAGES2_H=$(STATICINCLUDE)/messages2.h UBX_PROTOCOL_H=$(STATICINCLUDE)/ubx_protocol.h @@ -58,79 +88,72 @@ XSENS_PROTOCOL_H=$(STATICINCLUDE)/xsens_protocol.h DL_PROTOCOL_H=$(STATICINCLUDE)/dl_protocol.h DL_PROTOCOL2_H=$(STATICINCLUDE)/dl_protocol2.h ABI_MESSAGES_H=$(STATICINCLUDE)/abi_messages.h -MESSAGES_XML = $(CONF)/messages.xml -UBX_XML = $(CONF)/ubx.xml -MTK_XML = $(CONF)/mtk.xml -XSENS_XML = $(CONF)/xsens_MTi-G.xml -TOOLS=$(PAPARAZZI_SRC)/sw/tools -OCAML=$(shell which ocaml) -OCAMLRUN=$(shell which ocamlrun) -BUILD_DATETIME:=$(shell date +%Y%m%d-%H%M%S) + +GEN_HEADERS = $(MESSAGES_H) $(MESSAGES2_H) $(UBX_PROTOCOL_H) $(MTK_PROTOCOL_H) $(XSENS_PROTOCOL_H) $(DL_PROTOCOL_H) $(DL_PROTOCOL2_H) $(ABI_MESSAGES_H) -all: print_build_version conf commands static +all: print_build_version update_google_version conf ext lib subdirs lpctools commands static print_build_version: @echo "------------------------------------------------------------" @echo "Building Paparazzi version" $(shell ./paparazzi_version) @echo "------------------------------------------------------------" -static: lib center tools cockpit multimon tmtc misc logalizer lpc21iap sim_static static_h usb_lib ext +update_google_version: + -$(MAKE) -C data/maps -conf: conf/conf.xml conf/control_panel.xml conf/maps.xml FORCE +conf: conf/conf.xml conf/control_panel.xml conf/maps.xml conf/%.xml :conf/%.xml.example [ -L $@ ] || [ -f $@ ] || cp $< $@ -conf/maps.xml: conf/maps.xml.example FORCE - -cd data/maps; $(MAKE) - $(Q)if test ! -e $@; then cp $< $@; fi -FORCE: +static: cockpit tmtc tools sim_static static_h lib: - cd $(LIB)/ocaml; $(MAKE) - -center: lib - cd sw/supervision; $(MAKE) - -tools: lib - cd $(TOOLS); $(MAKE) - -logalizer: lib - cd $(LOGALIZER); $(MAKE) - -sim_static : lib - cd $(SIMULATOR); $(MAKE) PAPARAZZI_SRC=$(PAPARAZZI_SRC) - -cockpit: lib - cd $(COCKPIT); $(MAKE) all - -tmtc: lib cockpit - cd $(TMTC); $(MAKE) all - -misc: - cd $(MISC); $(MAKE) all + $(MAKE) -C $(LIB)/ocaml multimon: - cd $(MULTIMON); $(MAKE) + $(MAKE) -C $(MULTIMON) -static_h: $(MESSAGES_H) $(MESSAGES2_H) $(UBX_PROTOCOL_H) $(MTK_PROTOCOL_H) $(XSENS_PROTOCOL_H) $(DL_PROTOCOL_H) $(DL_PROTOCOL2_H) $(ABI_MESSAGES_H) +cockpit: lib + $(MAKE) -C $(COCKPIT) -usb_lib: - @[ -d sw/airborne/arch/lpc21/lpcusb ] && (cd sw/airborne/arch/lpc21/lpcusb; $(MAKE)) || echo "Not building usb_lib: sw/airborne/arch/lpc21/lpcusb directory missing" +tmtc: lib cockpit multimon + $(MAKE) -C $(TMTC) + +tools: lib + $(MAKE) -C $(TOOLS) + +sim_static: lib + $(MAKE) -C $(SIMULATOR) ext: - $(MAKE) -C$(EXT) all + $(MAKE) -C $(EXT) -$(MESSAGES_H) : $(MESSAGES_XML) $(CONF_XML) tools +# +# make misc subdirs +# +subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ + +$(PPRZCENTER): lib + +$(LOGALIZER): lib + + +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 > /tmp/msg.h $(Q)mv /tmp/msg.h $@ $(Q)chmod a+r $@ -$(MESSAGES2_H) : $(MESSAGES_XML) $(CONF_XML) tools +$(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 > /tmp/msg2.h @@ -167,48 +190,31 @@ $(ABI_MESSAGES_H) : $(MESSAGES_XML) tools $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) $(TOOLS)/gen_abi.out $< airborne > /tmp/abi.h $(Q)mv /tmp/abi.h $@ + include Makefile.ac -sim : sim_static +ac_h ac fbw ap: static conf tools ext + +sim: sim_static -ac_h ac1 ac2 ac3 ac fbw ap: static conf - -##### preliminary hard wired arm7 bootloader rules # +# Commands # -# call with : make bl PROC=[TINY|FBW|AP|GENERIC] -bl: - cd $(AIRBORNE)/arch/lpc21/test/bootloader; $(MAKE) clean; $(MAKE) -BOOTLOADER_DEV=/dev/ttyUSB0 -upload_bl bl.upload: bl - lpc21isp -control $(AIRBORNE)/arch/lpc21/test/bootloader/bl.hex $(BOOTLOADER_DEV) 38400 12000 +# stuff to build and upload the lpc bootloader ... +include Makefile.lpctools +lpctools: lpc21iap usb_lib -JTAG_INTERFACE = olimex-jtag-tiny.cfg -#JTAG_INTERFACE = olimex-arm-usb-ocd.cfg +commands: paparazzi sw/simulator/launchsitl -upload_jtag: bl - openocd -f interface/$(JTAG_INTERFACE) -f board/olimex_lpc_h2148.cfg -c init -c halt -c "flash write_image erase $(AIRBORNE)/arch/lpc21/test/bootloader/bl.hex" -c reset -c shutdown +paparazzi: + cat src/paparazzi | sed s#OCAMLRUN#$(OCAMLRUN)# | sed s#OCAML#$(OCAML)# > $@ + chmod a+x $@ - - -lpc21iap: - cd sw/ground_segment/lpc21iap; $(MAKE) - -upgrade_bl bl.upgrade: bl lpc21iap - $(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/test/bootloader/bl_ram.elf - $(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/test/bootloader/bl.elf - -ms: - cd $(AIRBORNE)/arch/lpc21/lpcusb; $(MAKE) - cd $(AIRBORNE)/arch/lpc21/lpcusb/examples; $(MAKE) - -upload_ms ms.upload: ms - $(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/lpcusb/examples/msc.elf - -##### -##### +sw/simulator/launchsitl: + cat src/$(@F) | sed s#OCAMLRUN#$(OCAMLRUN)# | sed s#OCAML#$(OCAML)# > $@ + chmod a+x $@ run_sitl : $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/sim/simsitl @@ -219,21 +225,16 @@ install : uninstall : $(MAKE) -f Makefile.install PREFIX=$(PREFIX) uninstall -DISTRO=lenny -deb : - chmod u+x debian/rules - cp debian/control.$(DISTRO) debian/control - cp debian/changelog.$(DISTRO) debian/changelog - dpkg-buildpackage $(DEBFLAGS) -Ivar -rfakeroot -fast_deb: - $(MAKE) deb OCAMLC=ocamlc.opt DEBFLAGS=-b +# +# Cleaning +# clean: $(Q)rm -fr dox build-stamp configure-stamp conf/%gconf.xml debian/files debian/paparazzi-base debian/paparazzi-bin - $(Q)rm -f $(MESSAGES_H) $(MESSAGES2_H) $(UBX_PROTOCOL_H) $(MTK_PROTOCOL_H) $(DL_PROTOCOL_H) + $(Q)rm -f $(GEN_HEADERS) $(Q)find . -mindepth 2 -name Makefile -a ! -path "./sw/ext/*" -exec sh -c 'echo "Cleaning {}"; $(MAKE) -C `dirname {}` $@' \; - $(Q)make -C sw/ext clean + $(Q)$(MAKE) -C $(EXT) clean $(Q)find . -name '*~' -exec rm -f {} \; $(Q)rm -f paparazzi sw/simulator/launchsitl @@ -256,6 +257,11 @@ dist_clean_irreversible: clean ab_clean: find sw/airborne -name '*~' -exec rm -f {} \; + +# +# Tests +# + replace_current_conf_xml: test conf/conf.xml && mv conf/conf.xml conf/conf.xml.backup.$(BUILD_DATETIME) cp conf/tests_conf.xml conf/conf.xml @@ -263,19 +269,15 @@ replace_current_conf_xml: restore_conf_xml: test conf/conf.xml.backup.$(BUILD_DATETIME) && mv conf/conf.xml.backup.$(BUILD_DATETIME) conf/conf.xml -commands: paparazzi sw/simulator/launchsitl - -paparazzi: - cat src/paparazzi | sed s#OCAMLRUN#$(OCAMLRUN)# | sed s#OCAML#$(OCAML)# > $@ - chmod a+x $@ - -sw/simulator/launchsitl: - cat src/$(@F) | sed s#OCAMLRUN#$(OCAMLRUN)# | sed s#OCAML#$(OCAML)# > $@ - chmod a+x $@ - run_tests: cd tests; $(MAKE) test test: all replace_current_conf_xml run_tests restore_conf_xml -.PHONY: all print_build_version clean cleanspaces ab_clean dist_clean distclean dist_clean_irreversible run_sitl install uninstall test replace_current_conf_xml run_tests restore_conf_xml + +.PHONY: all print_build_version update_google_version \ +subdirs $(SUBDIRS) conf ext lib multimon cockpit tmtc tools\ +static sim_static lpctools \ +commands run_sitl 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 ca144e6f10..453dce2a0e 100644 --- a/Makefile.ac +++ b/Makefile.ac @@ -1,5 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- -# Paparazzi main $Id$ +# # Copyright (C) 2004 Pascal Brisset Antoine Drouin # # This file is part of paparazzi. @@ -47,7 +47,6 @@ SETTINGS_XML=$(ACINCLUDE)/settings.xml SETTINGS_MODULES=$(ACINCLUDE)/settings_modules.xml SETTINGS_TELEMETRY=$(ACINCLUDE)/settings_telemetry.xml MAKEFILE_AC=$(ACINCLUDE)/Makefile.ac -MAKE=make PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) MODULES_H=$(AC_GENERATED)/modules.h AIRCRAFT_MD5=$(AIRCRAFT_CONF_DIR)/aircraft.md5 @@ -183,4 +182,4 @@ clean_ac : $(Q)if (expr "$(AIRCRAFT)"); then : ; else echo "AIRCRAFT undefined: type 'make AIRCRAFT=AircraftName ...'"; exit 1; fi rm -fr $(PAPARAZZI_HOME)/var/$(AIRCRAFT) -.PHONY: all clean_ac print_version +.PHONY: all init all_ac_h all_ac_hclean_ac print_version diff --git a/Makefile.lpctools b/Makefile.lpctools new file mode 100644 index 0000000000..b8ccbdb350 --- /dev/null +++ b/Makefile.lpctools @@ -0,0 +1,35 @@ +# Hey Emacs, this is a -*- makefile -*- + +usb_lib: + @[ -d sw/airborne/arch/lpc21/lpcusb ] && (cd sw/airborne/arch/lpc21/lpcusb; $(MAKE)) || echo "Not building usb_lib: sw/airborne/arch/lpc21/lpcusb directory missing" + +bl: + cd $(AIRBORNE)/arch/lpc21/test/bootloader; $(MAKE) clean; $(MAKE) + +BOOTLOADER_DEV=/dev/ttyUSB0 +upload_bl bl.upload: bl + lpc21isp -control $(AIRBORNE)/arch/lpc21/test/bootloader/bl.hex $(BOOTLOADER_DEV) 38400 12000 + +JTAG_INTERFACE = olimex-jtag-tiny.cfg +#JTAG_INTERFACE = olimex-arm-usb-ocd.cfg + +upload_jtag: bl + openocd -f interface/$(JTAG_INTERFACE) -f board/olimex_lpc_h2148.cfg -c init -c halt -c "flash write_image erase $(AIRBORNE)/arch/lpc21/test/bootloader/bl.hex" -c reset -c shutdown + + + +lpc21iap: + $(MAKE) -C sw/ground_segment/lpc21iap + +upgrade_bl bl.upgrade: bl lpc21iap + $(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/test/bootloader/bl_ram.elf + $(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/test/bootloader/bl.elf + +ms: + $(MAKE) -C $(AIRBORNE)/arch/lpc21/lpcusb + $(MAKE) -C $(AIRBORNE)/arch/lpc21/lpcusb/examples + +upload_ms ms.upload: ms + $(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/lpcusb/examples/msc.elf + +.PHONY: usb_lib bl upload_bl upload_jtag ms upload_ms lpc21iap upgrade_bl diff --git a/conf/Makefile.geode b/conf/Makefile.geode index 77abf8b799..3ef8e7d776 100644 --- a/conf/Makefile.geode +++ b/conf/Makefile.geode @@ -1,6 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2009 Antoine Drouin # # This file is part of paparazzi. @@ -18,8 +17,8 @@ # 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. -# +# Boston, MA 02111-1307, USA. +# # Define programs and commands. CC = gcc @@ -45,9 +44,9 @@ CFLAGS += -mtune=geode # optimize for geode # flags only for C CFLAGS + = -Wstrict-prototypes -Wmissing-declarations -CFLAGS += -Wmissing-prototypes -Wnested-externs +CFLAGS += -Wmissing-prototypes -Wnested-externs CFLAGS += $(CSTANDARD) -CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) +CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) #Additional libraries. MATH_LIB = -lm @@ -63,7 +62,7 @@ build: elf elf: $(OBJDIR)/$(TARGET).elf -# Program the device. +# Program the device. load upload program: $(OBJDIR)/$(TARGET).elf scp $(OBJDIR)/$(TARGET).elf $(USER)@$(HOST):$(TARGET_DIR) @@ -78,7 +77,7 @@ load upload program: $(OBJDIR)/$(TARGET).elf $(OBJDIR)/%.o : %.c $(OBJDIR)/../Makefile.ac @echo CC $@ $(Q)test -d $(dir $@) || mkdir -p $(dir $@) - $(Q)$(CC) -c $(CFLAGS) $< -o $@ + $(Q)$(CC) -c $(CFLAGS) $< -o $@ # Listing of phony targets. .PHONY : all build elf clean clean_list @@ -92,8 +91,8 @@ $(OBJDIR)/.depend: @test -d $(OBJDIR) || mkdir -p $(OBJDIR) $(Q)$(CC) -MM -MG $(CFLAGS) $($(TARGET).CFLAGS) $($(TARGET).srcs) | sed 's|\([^\.]*\.o\)|$(OBJDIR)/\1|' > $@ -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),erase) +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(MAKECMDGOALS),erase) -include $(OBJDIR)/.depend endif endif diff --git a/conf/Makefile.jsbsim b/conf/Makefile.jsbsim index 97ee1663b5..22799285b3 100644 --- a/conf/Makefile.jsbsim +++ b/conf/Makefile.jsbsim @@ -1,6 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- # -# $Id: Makefile.sim 3505 2009-06-17 12:59:32Z hecto $ # Copyright (C) 2006 Pascal Brisset, Antoine Drouin # # This file is part of paparazzi. diff --git a/conf/Makefile.local b/conf/Makefile.local index 4e15edb551..0958fa2da5 100644 --- a/conf/Makefile.local +++ b/conf/Makefile.local @@ -1,3 +1,5 @@ +# Hey Emacs, this is a -*- makefile -*- + DESTDIR=/ ifeq ($(PAPARAZZI_HOME),) diff --git a/conf/Makefile.lpc21 b/conf/Makefile.lpc21 index a1b8bc298d..a05a6187fb 100644 --- a/conf/Makefile.lpc21 +++ b/conf/Makefile.lpc21 @@ -1,6 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin # # This file is part of paparazzi. diff --git a/conf/Makefile.nps b/conf/Makefile.nps index 179066f73e..d8fa4f449a 100644 --- a/conf/Makefile.nps +++ b/conf/Makefile.nps @@ -88,6 +88,7 @@ $(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac $(Q)test -d $(dir $@) || mkdir -p $(dir $@) $(Q)$(CC) $(CFLAGS) -c -o $@ $< +.PHONY: all compile check_jsbsim # # Dependencies diff --git a/conf/Makefile.omap b/conf/Makefile.omap index ed065c5dca..1597b99548 100644 --- a/conf/Makefile.omap +++ b/conf/Makefile.omap @@ -1,6 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2009-2010 The Paparazzi Team # # This file is part of paparazzi. diff --git a/conf/Makefile.pentium-m b/conf/Makefile.pentium-m index bd42bc5476..573088b35f 100644 --- a/conf/Makefile.pentium-m +++ b/conf/Makefile.pentium-m @@ -1,6 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2009 Antoine Drouin # # This file is part of paparazzi. diff --git a/conf/Makefile.sim b/conf/Makefile.sim index b073cba04b..45fd9def02 100644 --- a/conf/Makefile.sim +++ b/conf/Makefile.sim @@ -1,6 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2006 Pascal Brisset, Antoine Drouin # # This file is part of paparazzi. @@ -132,6 +131,7 @@ $(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac $(Q)test -d $(dir $@) || mkdir -p $(dir $@) $(Q)$(CC) $(CFLAGS) -c -o $@ $< +.PHONY: all compile check_jsbsim # # Dependencies diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index f82913db43..7be57c406a 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -1,6 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2009 Antoine Drouin # # This file is part of paparazzi. @@ -345,9 +344,8 @@ clean_list : # Listing of phony targets. -.PHONY : all sizebefore sizeafter \ -build elf bin lss sym clean clean_list upload - +.PHONY : all sizebefore sizeafter printcommands printmultilib\ +build elf bin lss sym clean clean_list upload start_gdb start_telnet # # Dependencies diff --git a/data/maps/Makefile b/data/maps/Makefile index e10e204575..84535db711 100644 --- a/data/maps/Makefile +++ b/data/maps/Makefile @@ -1,23 +1,34 @@ +# Hey Emacs, this is a -*- makefile -*- + DATADIR = $(PAPARAZZI_HOME)/conf/maps_data Q=@ -all: $(DATADIR)/maps.google.com $(PAPARAZZI_HOME)/conf/maps.xml +all: $(PAPARAZZI_HOME)/conf/maps.xml clean: - + rm -f $(DATADIR)/maps.google.com $(DATADIR): mkdir $(DATADIR) $(DATADIR)/maps.google.com: $(DATADIR) FORCE + @echo "-----------------------------------------------" @echo "DOWNLOAD: google maps version code"; $(Q)wget -q -O $(@) http://maps.google.com/ || \ - (rm -f $(@) && echo "Could not download google maps version code" && exit 1) + (rm -f $(@) && \ + echo "Could not download google maps version code" && \ + echo "-----------------------------------------------" && \ + exit 1) $(PAPARAZZI_HOME)/conf/maps.xml: $(DATADIR)/maps.google.com - $(Q)echo "" > $(@) - $(Q)echo "" >> $(@) - $(Q)echo "" >> $(@) - $(Q)echo "" >> $(@) + $(eval GOOGLE_VERSION := $(shell grep -P "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.*##')) + @echo "Updated google maps version to $(GOOGLE_VERSION)" + @echo "-----------------------------------------------" + $(Q)echo "" > /tmp/maps.xml + $(Q)echo "" >> /tmp/maps.xml + $(Q)echo "" >> /tmp/maps.xml + $(Q)echo "" >> /tmp/maps.xml + $(Q)mv /tmp/maps.xml $@ FORCE: +.PHONY: all clean diff --git a/sw/airborne/arch/lpc21/lpcusb/Makefile b/sw/airborne/arch/lpc21/lpcusb/Makefile index 271f6441ae..8eda73cec2 100644 --- a/sw/airborne/arch/lpc21/lpcusb/Makefile +++ b/sw/airborne/arch/lpc21/lpcusb/Makefile @@ -1,3 +1,28 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# Copyright (C) 2004 Pascal Brisset, Antoine Drouin +# +# 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. + +# The default is to produce a quiet echo of compilation commands +# Launch with "make Q=''" to get full echo +Q=@ + LIBNAME = libusbstack # Package definitions @@ -36,7 +61,8 @@ LIBOBJS = $(LIBSRCS:.c=.o) all: depend lib clean: - $(RM) -f $(LIBNAME).a $(LIBOBJS) .depend + @echo CLEAN $(LIBNAME) + $(Q)$(RM) -f $(LIBNAME).a $(LIBOBJS) .depend # build lib lib: $(LIBNAME).a @@ -53,7 +79,7 @@ $(LIBOBJS): Makefile # dependency checking depend: $(LIBSRCS) - $(CC) $(CFLAGS) -MM $^ > .depend || rm -f .depend + $(Q)$(CC) $(CFLAGS) -MM $^ > .depend || rm -f .depend # phony targets .PHONY: all clean depend diff --git a/sw/ext/Makefile b/sw/ext/Makefile index fc89a7def0..61a6d800de 100644 --- a/sw/ext/Makefile +++ b/sw/ext/Makefile @@ -1,7 +1,6 @@ # Hey Emacs, this is a -*- makefile -*- # -# Paparazzi main $Id$ -# Copyright (C) 2004 Pascal Brisset Antoine Drouin +# Copyright (C) 2012 The Paparazzi Team # # This file is part of paparazzi. # @@ -24,6 +23,7 @@ # Launch with "make Q=''" to get full echo Q=@ + PAPARAZZI_SRC=../.. EXT_DIR=$(PAPARAZZI_SRC)/sw/ext @@ -45,23 +45,25 @@ ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),) endif -all: update_submodules libopencm3.module luftboot.module +all: libopencm3.module luftboot.module update_submodules: $(Q)if [ -d $(PAPARAZZI_SRC)/.git ]; then \ cd $(PAPARAZZI_SRC) && git submodule update --quiet --init; \ fi -libopencm3.module: - $(Q)make -C libopencm3 lib PREFIX=$(PREFIX) +libopencm3.module: update_submodules + $(Q)$(MAKE) -C libopencm3 lib PREFIX=$(PREFIX) -luftboot.module: libopencm3.module - $(Q)make -C luftboot/src all LIBOPENCM3=../../libopencm3 +luftboot.module: update_submodules libopencm3.module + $(Q)$(MAKE) -C luftboot/src all LIBOPENCM3=../../libopencm3 clean: $(Q)if [ -f libopencm3/Makefile ]; then \ - make -C $(EXT_DIR)/libopencm3 clean; \ + $(MAKE) -C $(EXT_DIR)/libopencm3 clean; \ fi $(Q)if [ -f luftboot/src/Makefile ]; then \ - make -C luftboot/src clean; \ + $(MAKE) -C luftboot/src clean; \ fi + +.PHONY: all clean update_submodules libopencm3.module luftboot.module diff --git a/sw/ground_segment/cockpit/Makefile b/sw/ground_segment/cockpit/Makefile index d227ebaf5d..c3697ac744 100644 --- a/sw/ground_segment/cockpit/Makefile +++ b/sw/ground_segment/cockpit/Makefile @@ -1,5 +1,5 @@ +# Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2003 Pascal Brisset, Antoine Drouin # # This file is part of paparazzi. @@ -35,12 +35,17 @@ 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) -INCLUDES= $(shell ocamlfind query -r -i-format lablgtk2) -I ../../lib/ocaml $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format pcre) $(OCAMLNETINCLUDES) +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 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 @@ -51,7 +56,7 @@ all : $(MAIN) opt : $(MAIN).opt -$(MAIN) : $(CMO) ../../lib/ocaml/xlib-pprz.cma ../../lib/ocaml/lib-pprz.cma +$(MAIN) : $(CMO) $(XLIBPPRZCMA) $(LIBPPRZCMA) @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 $@ @@ -89,9 +94,9 @@ compass : compass.ml clean: - rm -f *~* *.cm* *.o *.out *.opt map2d gcs .depend gtk_strip.ml gtk_setting_time.ml gtk_save_settings.ml - + 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 CC = gcc @@ -117,7 +122,7 @@ actuators : actuators.c # .depend: Makefile - ocamldep -I ../../lib/ocaml *.ml* > .depend + $(OCAMLDEP) -I $(LIBPPRZDIR) *.ml* > .depend ifneq ($(MAKECMDGOALS),clean) -include .depend diff --git a/sw/ground_segment/joystick/Makefile b/sw/ground_segment/joystick/Makefile index 68a9af19e9..f97df266ef 100644 --- a/sw/ground_segment/joystick/Makefile +++ b/sw/ground_segment/joystick/Makefile @@ -1,5 +1,5 @@ +# Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2004 Pascal Brisset, Antoine Drouin # Copyright (C) 2012 The Paparazzi Team # @@ -25,10 +25,12 @@ Q=@ OCAMLC = ocamlc -OCAMLLIB = ../../lib/ocaml +OCAMLDEP = ocamldep +LIBPPRZDIR = ../../lib/ocaml TOOLSDIR = ../../tools -OCAMLINCLUDES= -I $(OCAMLLIB) $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) -I $(TOOLSDIR) -LIBPPRZCMA=$(OCAMLLIB)/lib-pprz.cma +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 + # 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)) @@ -42,6 +44,9 @@ test_stick: test_sdl_stick.o 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) +# dependency of input2ivy +input2ivy: $(LIBPPRZCMA) $(TOOLSDIR)/fp_proc.cmo + %.o : %.c gcc -c -O2 -Wall `pkg-config glib-2.0 --cflags` $(INCLUDES) $< @@ -51,3 +56,16 @@ input2ivy: sdl_stick.o ml_sdl_stick.o input2ivy.cmo clean: rm -f *~ core *.o *.bak .depend test*stick *.cmo *.cmi input2ivy + +.PHONY: all clean + +# +# Dependencies +# + +.depend: Makefile + $(OCAMLDEP) -I $(LIBPPRZDIR) *.ml* > .depend + +ifneq ($(MAKECMDGOALS),clean) +-include .depend +endif diff --git a/sw/ground_segment/lpc21iap/Makefile b/sw/ground_segment/lpc21iap/Makefile index 46dba93c19..aa21d78a0b 100644 --- a/sw/ground_segment/lpc21iap/Makefile +++ b/sw/ground_segment/lpc21iap/Makefile @@ -52,3 +52,5 @@ arch: clean # Builds release tar file dist: clean cd .. && $(TAR) --exclude={CVS,cvs} -cvzf $(PKG_NAME)-$(DATE).tar.gz $(PKG_NAME) + +.PHONY: all clean app arch dist diff --git a/sw/ground_segment/misc/Makefile b/sw/ground_segment/misc/Makefile index aee015479b..b07280b130 100644 --- a/sw/ground_segment/misc/Makefile +++ b/sw/ground_segment/misc/Makefile @@ -1,3 +1,30 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# Copyright (C) 2010-2012 The Paparazzi Team +# +# 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. + +# Quiet compilation +# Launch with "make Q=''" to get full command display +Q=@ + +CC = gcc + UNAME = $(shell uname -s) ifeq ("$(UNAME)","Darwin") @@ -14,10 +41,12 @@ clean: rm -f *.o davis2ivy kestrel2ivy davis2ivy: davis2ivy.o - g++ -o davis2ivy davis2ivy.o $(LIBRARYS) -livy + $(Q)$(CC) -o davis2ivy davis2ivy.o $(LIBRARYS) -livy kestrel2ivy: kestrel2ivy.o - g++ -o kestrel2ivy kestrel2ivy.o $(LIBRARYS) -livy + $(Q)$(CC) -o kestrel2ivy kestrel2ivy.o $(LIBRARYS) -livy %.o : %.c - gcc -c -O2 -Wall $(INCLUDES) $< + $(Q)$(CC) -c -O2 -Wall $(INCLUDES) $< + +.PHONY: all clean diff --git a/sw/ground_segment/multimon/Makefile b/sw/ground_segment/multimon/Makefile index fba91e3d81..91af6142f0 100644 --- a/sw/ground_segment/multimon/Makefile +++ b/sw/ground_segment/multimon/Makefile @@ -1,4 +1,26 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# Copyright (C) 2003-2012 The Paparazzi Team +# +# 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. + # Quiet compilation +# Launch with "make Q=''" to get full command display Q=@ DEBUG =n @@ -111,12 +133,14 @@ hdlc.cmo : hdlc.cmi $(OCAMLC) $< clean: - rm -fr *.cm* mkcostab + 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 +.PHONY: all clean depend dep + depend dep: $(CPP) -M $(CFLAGS) $(SRC_MISC) $(SRC_L1) $(SRC_L2) $(SRC_GEN) mkcostab.c > $(BINDIR)/.depend diff --git a/sw/ground_segment/tmtc/Makefile b/sw/ground_segment/tmtc/Makefile index 34daf7516f..8449654b50 100644 --- a/sw/ground_segment/tmtc/Makefile +++ b/sw/ground_segment/tmtc/Makefile @@ -1,5 +1,5 @@ +# Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin # # This file is part of paparazzi. @@ -35,87 +35,92 @@ include ../../../conf/Makefile.local CONF = ../../../conf VAR = ../../../var -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 - OCAMLC = ocamlc OCAMLOPT = ocamlopt -OCAMLLIB = ../../lib/ocaml +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 $(OCAMLLIB) -I ../multimon $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) $(OCAMLNETINCLUDES) -LIBPPRZCMA=$(OCAMLLIB)/lib-pprz.cma +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) + +LIBMULTIMONCMA=../multimon/multimon.cma SERVERCMO = server_globals.cmo aircraft.cmo wind.cmo airprox.cmo kml.cmo fw_server.ml rotorcraft_server.ml server.cmo 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 + + $(VAR)/boa.conf :$(CONF)/boa.conf mkdir -p $(VAR) sed 's|PAPARAZZI_HOME|$(PAPARAZZI_HOME)|' < $< > $@ - chmod a+x boa -messages : messages.cmo ../../lib/ocaml/xlib-pprz.cma ../../lib/ocaml/lib-pprz.cma +messages : messages.cmo $(XLIBPPRZCMA) $(LIBPPRZCMA) @echo OL $@ $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma gtkInit.cmo $< -settings : settings.cmo ../../lib/ocaml/xlib-pprz.cma ../../lib/ocaml/lib-pprz.cma ../cockpit/page_settings.cmo +settings : settings.cmo $(XLIBPPRZCMA) $(LIBPPRZCMA) ../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 $< -server : $(SERVERCMO) ../../lib/ocaml/lib-pprz.cma +server : $(SERVERCMO) $(LIBPPRZCMA) @echo OL $@ $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma $(SERVERCMO) -server.opt : $(SERVERCMX) ../../lib/ocaml/lib-pprz.cmxa +server.opt : $(SERVERCMX) $(LIBPPRZCMXA) @echo OOL $@ $(Q)$(OCAMLOPT) $(INCLUDES) -o $@ str.cmxa unix.cmxa xml-light.cmxa lablgtk.cmxa glibivy-ocaml.cmxa lib-pprz.cmxa $(SERVERCMX) -LINKCMO=link.cmo - -link : $(LINKCMO) ../../lib/ocaml/lib-pprz.cma +link : link.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $(LINKCMO) + $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< -ivy_tcp_aircraft : ivy_tcp_aircraft.cmo ../../lib/ocaml/lib-pprz.cma +ivy_tcp_aircraft : ivy_tcp_aircraft.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma ivy_tcp_aircraft.cmo + $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< -ivy_tcp_controller : ivy_tcp_controller.cmo ../../lib/ocaml/lib-pprz.cma +ivy_tcp_controller : ivy_tcp_controller.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma ivy_tcp_controller.cmo + $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< -broadcaster : broadcaster.cmo ../../lib/ocaml/lib-pprz.cma +broadcaster : broadcaster.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma broadcaster.cmo + $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< -ivy2udp : ivy2udp.cmo ../../lib/ocaml/lib-pprz.cma +ivy2udp : ivy2udp.cmo $(LIBPPRZCMA) @echo OL $@ $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma $< -dia : dia.cmo ../multimon/multimon.cma +dia : dia.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) @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) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< -diadec : diadec.cmo ../multimon/multimon.cma +diadec : diadec.cmo $(LIBMULTIMONCMA) $(LIBPPRZCMA) @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) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $< -150m : 150m.cmo +150m : 150m.cmo $(LIBPPRZCMA) @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) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma gtkInit.cmo $< settings.cmo : INCLUDES += -I ../cockpit settings.cmo : ../cockpit/page_settings.cmi @@ -162,12 +167,14 @@ ivy_serial_bridge: ivy_serial_bridge.c $(CC) $(GTK_CFLAGS) $(C_LIBRARYS) $(C_INCLUDES) -o $@ $< $(GTK_LDFLAGS) +.PHONY: all clean + # # Dependencies # .depend: Makefile - ocamldep -I ../../lib/ocaml *.ml* > .depend + $(OCAMLDEP) -I $(LIBPPRZDIR) -I ../multimon *.ml* > .depend ifneq ($(MAKECMDGOALS),clean) -include .depend diff --git a/sw/lib/ocaml/Makefile b/sw/lib/ocaml/Makefile index 1f4f9cd655..96c9917271 100644 --- a/sw/lib/ocaml/Makefile +++ b/sw/lib/ocaml/Makefile @@ -1,5 +1,5 @@ +# Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2003 Pascal Brisset, Antoine Drouin # # This file is part of paparazzi. @@ -33,6 +33,7 @@ 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 @@ -154,7 +155,7 @@ gtk_papget_led_editor.ml : widgets.glade @rm /tmp/$@_$< clean : - rm -f *~ *.cm* *.out *.opt .depend *.a *.o *.so tests gtk_papget_*.ml expr_parser.ml expr_parser.mli expr_lexer.ml expr_lexer.mli + 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 .PHONY: all opt clean @@ -163,7 +164,7 @@ clean : # .depend: Makefile - ocamldep *.ml* > .depend + $(OCAMLDEP) *.ml* > .depend ifneq ($(MAKECMDGOALS),clean) -include .depend diff --git a/sw/logalizer/Makefile b/sw/logalizer/Makefile index 086b91a9f3..7478e5a918 100644 --- a/sw/logalizer/Makefile +++ b/sw/logalizer/Makefile @@ -1,5 +1,5 @@ +# Hey Emacs, this is a -*- makefile -*- # -# $Id$ # Copyright (C) 2004 Pascal Brisset, Antoine Drouin # # This file is part of paparazzi. @@ -24,8 +24,14 @@ Q=@ OCAMLC = ocamlc +OCAMLDEP = ocamldep OCAMLOPT = ocamlopt -INCLUDES= $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format lablgtk2) -I ../lib/ocaml +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) all: play plotter plot sd2log plotprofile openlog2tlm @@ -56,9 +62,10 @@ LDFLAGS= openlog2tlm: openlog2tlm.c $(CC) $(CFLAGS) -g -o $@ $^ - -play play-nox plotter sd2log : ../lib/ocaml/lib-pprz.cma -plot : ../lib/ocaml/lib-pprz.cmxa +# depedency on lib-pprz +play play-nox sd2log : $(LIBPPRZCMA) +plotter : $(LIBPPRZCMA) $(XLIBPPRZCMA) +plot : $(LIBPPRZCMXA) $(XLIBPPRZCMXA) # Target for bytecode executable (if ocamlopt is not available) # plot : log_file.cmo gtk_export.cmo export.cmo plot.cmo @@ -178,14 +185,16 @@ 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 + 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 # # Dependencies # .depend: Makefile - ocamldep -I ../lib/ocaml *.ml* > .depend + ocamldep -I $(LIBPPRZDIR) *.ml* > .depend ifneq ($(MAKECMDGOALS),clean) -include .depend diff --git a/sw/simulator/Makefile b/sw/simulator/Makefile index f0f124b9d1..90cf799fc1 100644 --- a/sw/simulator/Makefile +++ b/sw/simulator/Makefile @@ -1,4 +1,4 @@ -# Paparazzi simulator $Id$ +# Hey Emacs, this is a -*- makefile -*- # # Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin # @@ -40,18 +40,20 @@ SIMSCMX=$(SIMSML:%.ml=%.cmx) OCAMLC = ocamlc -g -OCAMLOPT=ocamlopt +OCAMLOPT = ocamlopt +OCAMLDEP = ocamldep OCAML=$(shell which ocaml) OCAMLRUN=$(shell which ocamlrun) -INCLUDES= $(shell ocamlfind query -r -i-format lablgtk2) -I ../lib/ocaml $(shell ocamlfind query -r -i-format xml-light) +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) -LAUNCHSITL = launchsitl + all : gaia sitl.cma $(LAUNCHSITL) simhitl - @chmod a+x $(LAUNCHSITL) simhitl : fg.o $(SIMHCMO) simhitl.cmo @echo OL $@ @@ -72,7 +74,7 @@ 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 $^ -%.cmo : %.ml ../lib/ocaml/lib-pprz.cma +%.cmo : %.ml @echo OC $< $(Q)$(OCAMLC) $(INCLUDES) -c $< @@ -84,24 +86,29 @@ diffusion : stdlib.cmo diffusion.cmo @echo OOC $< $(Q)$(OCAMLOPT) $(INCLUDES) -c $< -%.cmi : %.mli ../lib/ocaml/lib-pprz.cma +%.cmi : %.mli @echo OC $< $(Q)$(OCAMLC) $(INCLUDES) -c $< -clean : - rm -f *.cm* *~ *.out .depend *.o *.a *.so gaia simhitl booz_sim test2 - launchsitl : cat ../../src/$(@F) | sed s#OCAMLRUN#$(OCAMLRUN)# | sed s#OCAML#$(OCAML)# > $@ chmod a+x $@ +# dependency on lib-pprz +simhitl diffusion gaia: $(LIBPPRZCMA) + +clean : + rm -f *.cm* *~ *.out .depend *.o *.a *.so gaia simhitl diffusion + +.PHONY: all clean + # # Dependencies # -.depend: - ocamldep *.ml* > .depend +.depend: Makefile + $(OCAMLDEP) -I $(LIBPPRZDIR) *.ml* > .depend ifneq ($(MAKECMDGOALS),clean) -include .depend diff --git a/sw/supervision/Makefile b/sw/supervision/Makefile index 51f596d63d..75331ef8c7 100644 --- a/sw/supervision/Makefile +++ b/sw/supervision/Makefile @@ -1,16 +1,39 @@ -# Quiet +# Hey Emacs, this is a -*- makefile -*- +# +# Copyright (C) 2004-2012 Pascal Brisset, Antoine Drouin +# +# 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. + +# The default is to produce a quiet echo of compilation commands +# Launch with "make Q=''" to get full echo Q=@ OCAMLC = ocamlc OCAMLOPT = ocamlopt -OCAMLLIB = ../lib/ocaml -INCLUDES= -I $(OCAMLLIB) $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) -LIBPPRZCMA=$(OCAMLLIB)/lib-pprz.cma +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 all: paparazzicenter -paparazzicenter : $(PAPARAZZICENTERCMO) $(OCAMLLIB)/lib-pprz.cma +paparazzicenter : $(PAPARAZZICENTERCMO) $(LIBPPRZDIR)/lib-pprz.cma @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 $^ @@ -30,19 +53,21 @@ gtk_process.ml : paparazzicenter.glade @echo OC $< $(Q)$(OCAMLC) $(INCLUDES) $< -paparazzicenter.cmo : gtk_pc.cmo gtk_process.cmo pc_common.cmo pc_control_panel.cmo pc_aircraft.cmo +pc_common.cmo: gtk_process.cmo -pc_control_panel.cmo pc_aircraft.cmo : pc_common.cmo +paparazzicenter.cmo : gtk_pc.cmo clean: \rm -f *.cm* gtk_pc.ml gtk_process.ml .depend paparazzicenter +.PHONY: all clean + # # Dependencies # -.depend: - ocamldep -I ../lib/ocaml *.ml* > .depend +.depend: Makefile + $(OCAMLDEP) -I $(LIBPPRZDIR) *.ml* > .depend ifneq ($(MAKECMDGOALS),clean) -include .depend diff --git a/sw/tools/Makefile b/sw/tools/Makefile index 98bcf64b5d..a417d4b144 100644 --- a/sw/tools/Makefile +++ b/sw/tools/Makefile @@ -1,4 +1,4 @@ -# $Id$ +# Hey Emacs, this is a -*- makefile -*- # # Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin # @@ -24,41 +24,37 @@ Q=@ OCAML=ocaml OCAMLC=ocamlc -INCLUDES=-I ../lib/ocaml $(shell ocamlfind query -r -i-format xml-light) -I . +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) -OCAMLLEX=ocamllex -OCAMLYACC=ocamlyacc +LIBPPRZCMA=$(LIBPPRZDIR)/lib-pprz.cma 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_abi.out find_free_msg_id.out gen_srtm.out mergelogs FP_CMO = fp_proc.cmo gen_flight_plan.cmo ABS_FP = $(FP_CMO:%=$$PAPARAZZI_SRC/sw/tools/%) -gen_flight_plan.out : $(FP_CMO) ../lib/ocaml/lib-pprz.cma +gen_flight_plan.out : $(FP_CMO) @echo OL $@ $(Q)$(OCAMLC) $(INCLUDES) -custom -o $@ unix.cma str.cma xml-light.cma ivy-ocaml.cma lib-pprz.cma $^ -fp_proc.cmo : fp_proc.cmi -gen_flight_plan.cmo : fp_proc.cmi - -gen_common.cmo : gen_common.cmi - -gen_srtm.out : ../lib/ocaml/lib-pprz.cma +gen_srtm.out : gen_common.cmo @echo OC $@ $(Q)$(OCAMLC) $(INCLUDES) $(OCAMLNETINCLUDES) -custom -o $@ unix.cma str.cma netstring.cma netclient.cma xml-light.cma ivy-ocaml.cma lib-pprz.cma gen_common.cmo $^ mergelogs: mergelogs.c gcc mergelogs.c -o mergelogs -%.out : %.ml gen_common.ml Makefile +%.out : %.ml gen_common.cmo $(LIBPPRZCMA) @echo OC $< $(Q)$(OCAMLC) $(INCLUDES) -o $@ unix.cma str.cma ivy-ocaml.cma xml-light.cma lib-pprz.cma gen_common.cmo $< @cat ../../pprz_src_test.sh > $@ @echo '$(OCAML) -I $$PAPARAZZI_SRC/sw/tools $(shell ocamlfind query -r -i-format xml-light) $(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 $@ -%.cmo : %.ml ../lib/ocaml/lib-pprz.cma +%.cmo : %.ml @echo OC $< $(Q)$(OCAMLC) $(INCLUDES) -c $< @@ -66,17 +62,22 @@ mergelogs: mergelogs.c @echo OC $< $(Q)$(OCAMLC) $(INCLUDES) -c $< -%.ml : %.mll - @echo OC $< - $(Q)$(OCAMLLEX) $< +# dependency on lib-pprz +gen_flight_plan.out gen_srtm.out : $(LIBPPRZCMA) -%.ml : %.mly - @echo OC $< - $(Q)$(OCAMLYACC) $< - -%.mli : %.mly - @echo OC $< - $(Q)$(OCAMLYACC) $< clean: - rm -f *.cm* *.out *~ fp_parser.ml fp_parser.mli mergelogs + rm -f *.cm* *.out *~ .depend fp_parser.ml fp_parser.mli mergelogs + +.PHONY: all clean + +# +# Dependencies +# + +.depend: Makefile + $(OCAMLDEP) -I $(LIBPPRZDIR) *.ml *.mli > .depend + +ifneq ($(MAKECMDGOALS),clean) +-include .depend +endif