owlps/owlps-ardrone/Makefile_drone

126 lines
3.4 KiB
Plaintext

# Source version
ifndef OWLPS_VERSION
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
endif
# Emplacement de la suite de cross-compilation
TOOLCHAIN_PREFIX = /arm
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/bin
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc
# Compilateur
CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc
# Répertoire d'installation
PREFIX=/usr/local
INSTALL_DIR= $(PREFIX)/bin
INSTALL_LIB= $(PREFIX)/lib
INSTALL_INC= $(PREFIX)/include
INSTALL_MAN= $(PREFIX)/share/man
# Commandes d'installation et de désinstallation
RM = rm -f
CP = cp
# Cible
TARGET=owlps-drone
DEPS = oc.o
# Flags
LIBOWLPS_DIR = ../libowlps
LIBOWLPSCLIENT_DIR = ../libowlps-client
LIBOWLPSRESULTREADER_DIR = ../libowlps-resultreader
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes \
-I$(LIBOWLPS_DIR) -I$(LIBOWLPSCLIENT_DIR) \
-I$(LIBOWLPSRESULTREADER_DIR)
#CFLAGS += -g -O0
DEPFLAGS = -MMD
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
PICFLAG = -fPIC
OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\"
OWLPSFLAGS += -D DEBUG
LOWLPS = -L$(LIBOWLPS_DIR) -lowlps
LOWLPSA = $(LIBOWLPS_DIR)/libowlps.a
LOWLPSCLIENTA = $(LIBOWLPSCLIENT_DIR)/libowlps-client.a
LOWLPSRESULTREADERA = $(LIBOWLPSRESULTREADER_DIR)/libowlps-resultreader.a
LIBS = $(LOWLPSCLIENTA) $(LOWLPSRESULTREADERA) -lrt -lm -pthread
DYNAMIC_LIBS = $(LOWLPS) $(LIBS)
SEMISTATIC_LIBS = $(LOWLPSA) $(LIBS)
STATIC_LIBS = $(LOWLPSA) $(LIBS)
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
LDFLAGS = $(IATHEROS) $(LATHEROS)
## Cibles de compilation standard ##
.PHONY: all semistatic static install uninstall clean purge help
#dynamic: $(TARGET)
semistatic: $(TARGET).semistatic
static: $(TARGET).static
all: semistatic static
# Cancel implicit make rule
%: %.c
%.o: %.c %.h
$(CC) $(XCFLAGS) $(IATHEROS) $(OWLPSFLAGS) -c $<
# Compilation du programme
$(TARGET) : $(TARGET).o $(DEPS)
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
$(TARGET).semistatic : $(TARGET).o $(DEPS)
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
$(TARGET).static : $(TARGET).o $(DEPS)
$(CC) $(LDFLAGS) -static $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
## Installation / désinstallation ##
install : $(TARGET)
@$(CP) $(TARGET) $(INSTALL_DIR)
@cd $(INSTALL_DIR) ; chown root:root $(TARGET) ; chmod 755 $(TARGET)
install-static : $(TARGET).static
@$(CP) $(TARGET).static $(INSTALL_DIR)
@cd $(INSTALL_DIR) ; chown root:root $(TARGET).static ; chmod 755 $(TARGET).static
uninstall :
@$(RM) $(INSTALL_DIR)/{$(TARGET),$(TARGET).static}
## Nettoyage ##
clean :
@$(RM) -fv *~ *.o *.d
purge : clean
@$(RM) -fv $(TARGET) $(TARGET).static
## Aide ##
help :
@echo -e "Bibliothèques nécessaires à la compilation :\n\
libowlps1.0 (fournie)\n\
\n\
Cibles possibles :\n\
$(TARGET) (cible par défaut) : Compile le programme $(TARGET).\n\
$(TARGET).static : Compile le programme $(TARGET).static \
(version sans lien dynamique).\n\
install : Installe le programme $(TARGET).\n\
uninstall : Désinstalle le programme $(TARGET).\n\
clean : Supprime les fichiers temporaires.\n\
purge : Supprime le résultat de la compilation.\n\
\n\
Note : l'installation se fait dans l'arborescence $(PREFIX). \
Modifiez la variable PREFIX du Makefile pour changer ce comportement."
# Local Variables: *
# mode: makefile-gmake *
# End: *