Add Makefiles for AR.Drone
This commit is contained in:
parent
12b52d9365
commit
290fcfa49b
|
@ -0,0 +1,74 @@
|
||||||
|
# Emplacement de la suite de cross-compilation
|
||||||
|
TOOLCHAIN_PREFIX = /arm
|
||||||
|
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/bin
|
||||||
|
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc/usr
|
||||||
|
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc
|
||||||
|
|
||||||
|
# Autres outils
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
RM = rm -fv
|
||||||
|
|
||||||
|
# Variables générales
|
||||||
|
LIB_CIBLE=libowlps-client
|
||||||
|
VERSION=1.0
|
||||||
|
|
||||||
|
# Cibles à construire
|
||||||
|
STATIC=$(LIB_CIBLE).a
|
||||||
|
HEADER=owlps-client.h
|
||||||
|
|
||||||
|
# Composition de la bibliothèque
|
||||||
|
OBJS=$(LIB_CIBLE).o
|
||||||
|
|
||||||
|
# Flags
|
||||||
|
CFLAGS=-O2 -Wall -Wextra -Wstrict-prototypes -O -I.
|
||||||
|
DEPFLAGS=-MMD
|
||||||
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG=-fPIC
|
||||||
|
LIBS=-liw
|
||||||
|
#STRIPFLAGS= -Wl,-s
|
||||||
|
#LDFLAGS=
|
||||||
|
LATHEROS=-L$(TOOLCHAIN_USR_2)/lib/
|
||||||
|
IATHEROS=-I$(TOOLCHAIN_USR)/include/
|
||||||
|
|
||||||
|
|
||||||
|
## Cibles de compilation standard ##
|
||||||
|
|
||||||
|
.PHONY : all static clean purge help
|
||||||
|
|
||||||
|
all : static
|
||||||
|
static : $(STATIC)
|
||||||
|
|
||||||
|
%.o : %.c $(HEADER)
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) -c $<
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque statique
|
||||||
|
$(STATIC) : $(OBJS)
|
||||||
|
$(RM) $@
|
||||||
|
$(AR) cru $@ $^
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
|
||||||
|
## Nettoyage ##
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@$(RM) *~ *.o *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) $(STATIC)
|
||||||
|
|
||||||
|
|
||||||
|
## Aide ##
|
||||||
|
|
||||||
|
help :
|
||||||
|
@echo "Bibliothèques nécessaires à la compilation :\n\
|
||||||
|
libowlps-dev\n\
|
||||||
|
\n\
|
||||||
|
Cibles possibles :\n\
|
||||||
|
static (cible par défaut) : Compile la bibliothèque statique (.a).\n\
|
||||||
|
\n\
|
||||||
|
clean : Supprime les fichiers temporaires.\n\
|
||||||
|
purge : Supprime le résultat de la compilation.\n\"
|
|
@ -0,0 +1,142 @@
|
||||||
|
TOOLCHAIN_PREFIX = /arm
|
||||||
|
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/bin
|
||||||
|
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc/usr
|
||||||
|
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc
|
||||||
|
|
||||||
|
# Répertoire d'installation
|
||||||
|
PREFIX=/usr/local
|
||||||
|
INSTALL_LIB= $(PREFIX)/lib
|
||||||
|
INSTALL_INC= $(PREFIX)/include
|
||||||
|
INSTALL_MAN= $(PREFIX)/share/man
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
|
||||||
|
CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc
|
||||||
|
|
||||||
|
# Autres outils
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
# Commandes d'installation et de désinstallation
|
||||||
|
RM=rm -fv
|
||||||
|
CP=cp -v
|
||||||
|
SYMLINK=ln -svf
|
||||||
|
|
||||||
|
# Variables générales
|
||||||
|
LIB_CIBLE=libowlps
|
||||||
|
VERSION=1.0
|
||||||
|
|
||||||
|
# Cibles à construire
|
||||||
|
STATIC=$(LIB_CIBLE).a
|
||||||
|
DYNAMIC=$(LIB_CIBLE).so.$(VERSION)
|
||||||
|
#PROGS=
|
||||||
|
HEADER=owlps.h
|
||||||
|
#HEADERS=
|
||||||
|
|
||||||
|
# Composition de la bibliothèque
|
||||||
|
OBJS=$(LIB_CIBLE).o
|
||||||
|
|
||||||
|
# Flags
|
||||||
|
CFLAGS=-O2 -Wall -Wextra -Wstrict-prototypes -O -I.
|
||||||
|
DEPFLAGS=-MMD
|
||||||
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG=-fPIC
|
||||||
|
LIBS = -liw -lrt
|
||||||
|
#STRIPFLAGS= -Wl,-s
|
||||||
|
#LDFLAGS=
|
||||||
|
LATHEROS=-L$(TOOLCHAIN_USR_2)/lib/
|
||||||
|
IATHEROS=-I$(TOOLCHAIN_USR)/include/
|
||||||
|
|
||||||
|
## Cibles de compilation standard ##
|
||||||
|
|
||||||
|
.PHONY : all dynamic static install install-dynamic install-static install-header uninstall uninstall-dynamic uninstall-static uninstall-header clean purge help
|
||||||
|
|
||||||
|
all : dynamic static
|
||||||
|
dynamic : $(DYNAMIC)
|
||||||
|
static : $(STATIC)
|
||||||
|
|
||||||
|
%.o: %.c $(HEADER)
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) $(PICFLAG) -c -o $@ $<
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque dynamique
|
||||||
|
$(DYNAMIC): $(OBJS)
|
||||||
|
$(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) $(IATHEROS) $(LATHEROS) -lc $^
|
||||||
|
$(SYMLINK) $@ $(LIB_CIBLE).so
|
||||||
|
chmod a-x $@
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque statique
|
||||||
|
$(STATIC): $(OBJS)
|
||||||
|
$(RM) $@
|
||||||
|
$(AR) cru $@ $^
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
|
||||||
|
## Installation ##
|
||||||
|
|
||||||
|
install : install-static install-dynamic
|
||||||
|
|
||||||
|
install-dynamic : install-header $(DYNAMIC)
|
||||||
|
@$(CP) $(DYNAMIC) $(INSTALL_LIB) &&\
|
||||||
|
chmod 644 $(INSTALL_LIB)/$(DYNAMIC) &&\
|
||||||
|
chown root:root $(INSTALL_LIB)/$(DYNAMIC) &&\
|
||||||
|
cd $(INSTALL_LIB) && $(SYMLINK) $(DYNAMIC) $(LIB_CIBLE).so &&\
|
||||||
|
echo "Reconstruction du cache pour ld.so : ldconfig $(INSTALL_LIB)" ; ldconfig $(INSTALL_LIB)
|
||||||
|
|
||||||
|
install-static : install-header $(STATIC)
|
||||||
|
@$(CP) $(STATIC) $(INSTALL_LIB) &&\
|
||||||
|
chmod 644 $(INSTALL_LIB)/$(STATIC) &&\
|
||||||
|
chown root:root $(INSTALL_LIB)/$(STATIC)
|
||||||
|
|
||||||
|
install-header : $(HEADER)
|
||||||
|
@$(CP) $(HEADER) $(INSTALL_INC) &&\
|
||||||
|
chmod 644 $(INSTALL_INC)/$(HEADER) &&\
|
||||||
|
chown root:root $(INSTALL_INC)/$(HEADER)
|
||||||
|
|
||||||
|
|
||||||
|
## Désinstallation ##
|
||||||
|
|
||||||
|
uninstall : uninstall-dynamic uninstall-static
|
||||||
|
|
||||||
|
uninstall-dynamic : uninstall-header
|
||||||
|
@$(RM) $(INSTALL_LIB)/$(DYNAMIC) $(INSTALL_LIB)/$(LIB_CIBLE).so
|
||||||
|
@echo "Reconstruction du cache pour ld.so : ldconfig" ; ldconfig
|
||||||
|
|
||||||
|
uninstall-static : uninstall-header
|
||||||
|
@$(RM) $(INSTALL_LIB)/$(STATIC)
|
||||||
|
|
||||||
|
uninstall-header :
|
||||||
|
@$(RM) $(INSTALL_INC)/$(HEADER)
|
||||||
|
|
||||||
|
|
||||||
|
## Nettoyage ##
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@$(RM) *~ *.o *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) $(DYNAMIC) *.so $(STATIC) $(PROGS)
|
||||||
|
|
||||||
|
|
||||||
|
## Aide ##
|
||||||
|
|
||||||
|
help :
|
||||||
|
@echo "Bibliothèques nécessaires à la compilation :\n\
|
||||||
|
libiw-dev\n\
|
||||||
|
\n\
|
||||||
|
Cibles possibles :\n\
|
||||||
|
all (cible par défaut) : Compile la bibliothèque et le programme d'exemple (tx).\n\
|
||||||
|
dynamic : Compile la bibilothèque partagée (.so).\n\
|
||||||
|
static : Compile la bibliothèque statique (.a).\n\
|
||||||
|
\n\
|
||||||
|
install : Installe la bibliothèque partagée et statique.\n\
|
||||||
|
install-dynamic : N'installe que la bibliothèque partagée.\n\
|
||||||
|
install-static : N'installe que la bibliothèque statique.\n\
|
||||||
|
\n\
|
||||||
|
uninstall : Désinstalle tout ce qu'il est possible de désinstaller.\n\
|
||||||
|
uninstall-dynamic : Désinstalle la bibliothèque partagée.\n\
|
||||||
|
uninstall-static : Désinstalle la bibliothèque statique.\n\
|
||||||
|
\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."
|
|
@ -19,17 +19,19 @@ RM=rm -fv
|
||||||
CP=cp -v
|
CP=cp -v
|
||||||
|
|
||||||
# Cible
|
# Cible
|
||||||
TARGET=owlps-
|
TARGET=owlps-drone
|
||||||
HEADER=
|
HEADER=
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
|
LIBOWLPS_DIR = ../libowlps
|
||||||
|
LIBOWLPSCLIENT_DIR = ../libowlps-client
|
||||||
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -I.
|
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -I.
|
||||||
DEPFLAGS = -MMD
|
DEPFLAGS = -MMD
|
||||||
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
PICFLAG = -fPIC
|
PICFLAG = -fPIC
|
||||||
LOWLPS = -L../../libowlps -lowlps
|
LOWLPS = -L$(LIBOWLPS_DIR) -lowlps
|
||||||
LOWLPSA = ../../libowlps/libowlps.a
|
LOWLPSA = $(LIBOWLPS_DIR)/libowlps.a
|
||||||
LOWLPSCLIENTA = ../libowlps-client/libowlps-client.a
|
LOWLPSCLIENTA = $(LIBOWLPSCLIENT_DIR)/libowlps-client.a
|
||||||
LIBS = $(LOWLPSCLIENTA) -liw -lm -lrt
|
LIBS = $(LOWLPSCLIENTA) -liw -lm -lrt
|
||||||
DYNAMIC_LIBS = $(LOWLPS) $(LIBS)
|
DYNAMIC_LIBS = $(LOWLPS) $(LIBS)
|
||||||
SEMISTATIC_LIBS = $(LOWLPSA) $(LIBS)
|
SEMISTATIC_LIBS = $(LOWLPSA) $(LIBS)
|
||||||
|
@ -53,7 +55,7 @@ all: semistatic static
|
||||||
%: %.o
|
%: %.o
|
||||||
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(DYNAMIC_LIBS)
|
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(DYNAMIC_LIBS)
|
||||||
|
|
||||||
%-ardrone: %.o
|
%-drone: %.o
|
||||||
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(SEMISTATIC_LIBS)
|
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(SEMISTATIC_LIBS)
|
||||||
|
|
||||||
%.static: %.o
|
%.static: %.o
|
||||||
|
@ -80,7 +82,7 @@ clean :
|
||||||
@$(RM) -fv *~ *.o *.d
|
@$(RM) -fv *~ *.o *.d
|
||||||
|
|
||||||
purge : clean
|
purge : clean
|
||||||
@$(RM) -fv $(TARGET) $(TARGET).static $(TARGET)-ardrone
|
@$(RM) -fv $(TARGET) $(TARGET).static $(TARGET)-drone
|
||||||
|
|
||||||
|
|
||||||
## Aide ##
|
## Aide ##
|
||||||
|
|
Loading…
Reference in New Issue