mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-02 13:27:32 +08:00
[conf] cleanup linux makefiles
This commit is contained in:
@@ -1,97 +0,0 @@
|
|||||||
# Hey Emacs, this is a -*- makefile -*-
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Define programs and commands.
|
|
||||||
CC = gcc
|
|
||||||
LD = $(CC)
|
|
||||||
|
|
||||||
# Launch with "make Q=''" to get full command display
|
|
||||||
Q=@
|
|
||||||
|
|
||||||
OPT ?= 3
|
|
||||||
CSTANDARD = -std=gnu99
|
|
||||||
CINCS = $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/include
|
|
||||||
|
|
||||||
# Compiler flags.
|
|
||||||
CFLAGS += $(CINCS)
|
|
||||||
CFLAGS += -O$(OPT)
|
|
||||||
# CFLAGS += -malignment-traps
|
|
||||||
CFLAGS += -Wall -Wcast-qual -Wimplicit -Wcast-align
|
|
||||||
CFLAGS += -Wpointer-arith -Wswitch
|
|
||||||
CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
|
|
||||||
CFLAGS += -Wa,-adhlns=$(OBJDIR)/$(notdir $(subst $(suffix $<),.lst,$<))
|
|
||||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
|
||||||
CFLAGS += -mtune=geode # optimize for geode
|
|
||||||
|
|
||||||
# flags only for C
|
|
||||||
CFLAGS + = -Wstrict-prototypes -Wmissing-declarations
|
|
||||||
CFLAGS += -Wmissing-prototypes -Wnested-externs
|
|
||||||
CFLAGS += $(CSTANDARD)
|
|
||||||
CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS)
|
|
||||||
|
|
||||||
#Additional libraries.
|
|
||||||
MATH_LIB = -lm
|
|
||||||
|
|
||||||
LDFLAGS = $(MATH_LIB)
|
|
||||||
|
|
||||||
SRCGEODE = $($(TARGET).srcs)
|
|
||||||
COBJGEODE = $(SRCGEODE:%.c=$(OBJDIR)/%.o)
|
|
||||||
|
|
||||||
all: build
|
|
||||||
|
|
||||||
build: $(OBJDIR) elf
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
@echo CREATING object dir $(OBJDIR)
|
|
||||||
@test -d $(OBJDIR) || mkdir -p $(OBJDIR)
|
|
||||||
|
|
||||||
elf: $(OBJDIR)/$(TARGET).elf
|
|
||||||
|
|
||||||
# Program the device.
|
|
||||||
upload program: $(OBJDIR)/$(TARGET).elf
|
|
||||||
scp $(OBJDIR)/$(TARGET).elf $(USER)@$(HOST):$(TARGET_DIR)
|
|
||||||
|
|
||||||
# Link: create ELF output file from object files.
|
|
||||||
.SECONDARY : $(OBJDIR)/$(TARGET).elf
|
|
||||||
.PRECIOUS : $(COBJGEODE)
|
|
||||||
%.elf: $(COBJGEODE)
|
|
||||||
@echo LD $@
|
|
||||||
$(Q)$(CC) $(CFLAGS) $(COBJGEODE) --output $@ $(LDFLAGS) $($(TARGET).LDFLAGS)
|
|
||||||
|
|
||||||
# Compile: create object files from C source files. ARM-only
|
|
||||||
$(OBJDIR)/%.o : %.c $(OBJDIR)/../Makefile.ac
|
|
||||||
@echo CC $@
|
|
||||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
|
||||||
$(Q)$(CC) -MMD -c $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
# Listing of phony targets.
|
|
||||||
.PHONY : all build elf clean clean_list
|
|
||||||
|
|
||||||
#
|
|
||||||
# Dependencies
|
|
||||||
#
|
|
||||||
|
|
||||||
DEPS = $(addprefix $(OBJDIR)/,$($(TARGET).srcs:.c=.d))
|
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
|
||||||
-include $(DEPS)
|
|
||||||
endif
|
|
||||||
+4
-1
@@ -25,7 +25,10 @@
|
|||||||
# Normally don't use this makefile directly, but rather Makefile.arm-linux or Makefile.bbb
|
# Normally don't use this makefile directly, but rather Makefile.arm-linux or Makefile.bbb
|
||||||
#
|
#
|
||||||
|
|
||||||
# Define programs and commands.
|
# Define some default programs and commands (if not already set by e.g. Makefile.arm-linux
|
||||||
|
CC ?= gcc
|
||||||
|
CXX ?= g++
|
||||||
|
LD ?= $(CC)
|
||||||
|
|
||||||
# Launch with "make Q=''" to get full command display
|
# Launch with "make Q=''" to get full command display
|
||||||
Q=@
|
Q=@
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
# Hey Emacs, this is a -*- makefile -*-
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Define programs and commands.
|
|
||||||
CC = gcc
|
|
||||||
LD = $(CC)
|
|
||||||
|
|
||||||
# Launch with "make Q=''" to get full command display
|
|
||||||
Q=@
|
|
||||||
|
|
||||||
OPT ?= 3
|
|
||||||
|
|
||||||
#
|
|
||||||
# OPT=O -g, turns off all optimization and turns on debugging.
|
|
||||||
#
|
|
||||||
#OPT=0 -ggdb
|
|
||||||
#
|
|
||||||
|
|
||||||
CSTANDARD = -std=gnu99
|
|
||||||
CINCS = $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/include
|
|
||||||
|
|
||||||
# Compiler flags.
|
|
||||||
CFLAGS += $(CINCS)
|
|
||||||
CFLAGS += -O$(OPT)
|
|
||||||
CFLAGS += -Wtype-limits -Wextra
|
|
||||||
# CFLAGS += -malignment-traps
|
|
||||||
CFLAGS += -Wall -Wcast-qual -Wimplicit -Wcast-align
|
|
||||||
CFLAGS += -Wpointer-arith -Wswitch
|
|
||||||
CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
|
|
||||||
CFLAGS += -Wa,-adhlns=$(OBJDIR)/$(notdir $(subst $(suffix $<),.lst,$<))
|
|
||||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
|
||||||
CFLAGS += -mtune=pentium-m # optimize for pentium-m
|
|
||||||
CFLAGS += -m32
|
|
||||||
|
|
||||||
# flags only for C
|
|
||||||
CFLAGS += -Wstrict-prototypes -Wmissing-declarations
|
|
||||||
CFLAGS += -Wmissing-prototypes -Wnested-externs
|
|
||||||
CFLAGS += $(CSTANDARD)
|
|
||||||
CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS)
|
|
||||||
|
|
||||||
#Additional libraries.
|
|
||||||
MATH_LIB = -lm
|
|
||||||
|
|
||||||
LDFLAGS = $(MATH_LIB)
|
|
||||||
|
|
||||||
SRCGEODE = $($(TARGET).srcs)
|
|
||||||
COBJGEODE = $(SRCGEODE:%.c=$(OBJDIR)/%.o)
|
|
||||||
|
|
||||||
all: build
|
|
||||||
|
|
||||||
build: $(OBJDIR) elf
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
@echo CREATING object dir $(OBJDIR)
|
|
||||||
@test -d $(OBJDIR) || mkdir -p $(OBJDIR)
|
|
||||||
|
|
||||||
elf: $(OBJDIR)/$(TARGET).elf
|
|
||||||
|
|
||||||
# Program the device.
|
|
||||||
upload program: $(OBJDIR)/$(TARGET).elf
|
|
||||||
ifdef USER
|
|
||||||
ssh $(USER)@$(HOST) "sudo mount -o remount,rw /"
|
|
||||||
scp $(OBJDIR)/$(TARGET).elf $(USER)@$(HOST):$(TARGET_DIR)
|
|
||||||
else
|
|
||||||
ssh $(HOST) "sudo mount -o remount,rw /"
|
|
||||||
scp $(OBJDIR)/$(TARGET).elf $(HOST):$(TARGET_DIR)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Link: create ELF output file from object files.
|
|
||||||
.SECONDARY : $(OBJDIR)/$(TARGET).elf
|
|
||||||
.PRECIOUS : $(COBJGEODE)
|
|
||||||
%.elf: $(COBJGEODE)
|
|
||||||
@echo LD $@
|
|
||||||
$(Q)$(CC) $(CFLAGS) $(COBJGEODE) --output $@ $(LDFLAGS) $($(TARGET).LDFLAGS)
|
|
||||||
|
|
||||||
# Compile: create object files from C source files. ARM-only
|
|
||||||
$(OBJDIR)/%.o : %.c $(OBJDIR)/../Makefile.ac
|
|
||||||
@echo CC $@
|
|
||||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
|
||||||
$(Q)$(CC) -MMD -c $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
# Listing of phony targets.
|
|
||||||
.PHONY : all build elf clean clean_list
|
|
||||||
|
|
||||||
#
|
|
||||||
# Dependencies
|
|
||||||
#
|
|
||||||
|
|
||||||
DEPS = $(addprefix $(OBJDIR)/,$($(TARGET).srcs:.c=.d))
|
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
|
||||||
-include $(DEPS)
|
|
||||||
endif
|
|
||||||
Reference in New Issue
Block a user