mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
114 lines
2.7 KiB
Makefile
114 lines
2.7 KiB
Makefile
# Hey Emacs, this is a -*- makefile -*-
|
|
#
|
|
# $Id$
|
|
# Copyright (C) 2006 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.
|
|
#
|
|
|
|
|
|
#
|
|
# This is the common Makefile for the avr-target.
|
|
# Edit the configuration part to suit your local install
|
|
#
|
|
|
|
SRC_ARCH = $(PAPARAZZI_SRC)/sw/airborne/sim
|
|
|
|
CC = gcc
|
|
OCAMLC = ocamlc -g
|
|
SIMDIR = $(PAPARAZZI_SRC)/sw/simulator
|
|
CAMLINCLUDES = -I +lablgtk2 -I $(PAPARAZZI_SRC)/sw/lib/ocaml -I $(SIMDIR)
|
|
SIMSITLML = $(OBJDIR)/simsitl.ml
|
|
SITLCMA = $(SIMDIR)/sitl.cma
|
|
|
|
# Launch with "make Q=''" to get full command display
|
|
Q=@
|
|
|
|
#
|
|
# End of configuration part.
|
|
#
|
|
|
|
INCLUDES += -I `ocamlc -where`
|
|
|
|
CFLAGS = \
|
|
-W -Wall \
|
|
$(INCLUDES) \
|
|
-Wstrict-prototypes \
|
|
$($(TARGET).CFLAGS) \
|
|
$(LOCAL_CFLAGS) \
|
|
-O2 \
|
|
|
|
LDFLAGS = -lm \
|
|
|
|
#
|
|
# General rules
|
|
#
|
|
|
|
$(TARGET).srcsnd = $(notdir $($(TARGET).srcs))
|
|
$(TARGET).objso = $($(TARGET).srcsnd:%.c=$(OBJDIR)/%.o)
|
|
$(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o)
|
|
|
|
all compile: $(OBJDIR)/simsitl
|
|
|
|
|
|
$(OBJDIR)/simsitl : $($(TARGET).objs) $(SITLCMA) $(SIMSITLML)
|
|
@echo LD $@
|
|
$(Q)$(OCAMLC) -custom $(CAMLINCLUDES) -o $@ glibivy-ocaml.cma lib-pprz.cma lablgtk.cma $($(TARGET).objs) gtkInit.cmo $(SITLCMA) $(SIMSITLML)
|
|
|
|
|
|
# The id of the A/C is hardcoded in the code (to be improved with dynlink ?)
|
|
$(SIMSITLML) : $(SIMDIR)/simsitl.ml
|
|
@echo "Sim.ac_name := \"$(AIRCRAFT)\"" > $@
|
|
@cat $< >> $@
|
|
|
|
%.s: %.c
|
|
$(CC) $(CFLAGS) -S -o $@ $<
|
|
|
|
$(OBJDIR)/%.s: %.c
|
|
$(CC) $(CFLAGS) -S -o $@ $<
|
|
|
|
$(OBJDIR)/%.o: %.c
|
|
@echo CC $@
|
|
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
$(OBJDIR)/%.o: $(SRC_ARCH)/%.c
|
|
@echo CC $@
|
|
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
$(OBJDIR)/%.o: $(SRC_ARCH)/%.S
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
avr_clean:
|
|
rm -rf $(OBJDIR)
|
|
|
|
|
|
#
|
|
# Dependencies
|
|
#
|
|
$(OBJDIR)/.depend:
|
|
@test -d $(OBJDIR) || mkdir -p $(OBJDIR)
|
|
@echo DEPEND $@
|
|
$(Q)$(CC) -MM -MG $(CFLAGS) $($(TARGET).srcs) | sed 's|\([^\.]*\.o\)|$(OBJDIR)/\1|' > $@
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
ifneq ($(MAKECMDGOALS),erase)
|
|
-include $(OBJDIR)/.depend
|
|
endif
|
|
endif
|