From 03b4105f1343bff499a1bf3a2cb672fed0cb719a Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Tue, 31 Jan 2012 15:11:54 +0100 Subject: [PATCH] [ARDrone] Update Makefiles Fix the existing Makefiles for the drone cross-compilation. Add libowlps-resultreader/Makefile_drone. --- libowlps-client/Makefile_drone | 5 +- libowlps-resultreader/Makefile_drone | 82 ++++++++++++++++++++++++++++ libowlps/Makefile_drone | 8 +-- owlps-ardrone/Makefile_drone | 13 ++++- 4 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 libowlps-resultreader/Makefile_drone diff --git a/libowlps-client/Makefile_drone b/libowlps-client/Makefile_drone index 1b971a5..c4854a9 100644 --- a/libowlps-client/Makefile_drone +++ b/libowlps-client/Makefile_drone @@ -10,7 +10,7 @@ CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc # Autres outils AR = ar RANLIB = ranlib -RM = rm -fv +RM = rm -f # Variables générales LIB_CIBLE=libowlps-client @@ -24,7 +24,8 @@ HEADER=owlps-client.h OBJS=$(LIB_CIBLE).o # Flags -CFLAGS=-O2 -Wall -Wextra -Wstrict-prototypes -O -I. +LIBOWLPS_DIR = ../libowlps +CFLAGS=-O2 -Wall -Wextra -Wstrict-prototypes -O -I$(LIBOWLPS_DIR) -I. DEPFLAGS=-MMD XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) PICFLAG=-fPIC diff --git a/libowlps-resultreader/Makefile_drone b/libowlps-resultreader/Makefile_drone new file mode 100644 index 0000000..8dee138 --- /dev/null +++ b/libowlps-resultreader/Makefile_drone @@ -0,0 +1,82 @@ +# 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 -f + +# Variables générales +LIB_CIBLE = libowlps-resultreader +VERSION = 1.0 + +# Cibles à construire +STATIC = $(LIB_CIBLE).a +HEADER = owlps-resultreader.h +EXAMPLE = owlps-resultreader-udp + +# Composition de la bibliothèque +OBJS = $(LIB_CIBLE).o + +# Flags +LIBOWLPS_DIR = ../libowlps +CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -I$(LIBOWLPS_DIR) -I. +#CFLAGS += -g -O0 +CFLAGS += -D DEBUG +DEPFLAGS = -MMD +XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) +PICFLAG = -fPIC +#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 example +static : $(STATIC) +example : $(EXAMPLE) + +# Cancel implicit make rule +%: %.c + +%.o : %.c $(HEADER) + $(CC) $(XCFLAGS) $(IATHEROS) -c $< + +% : %.o $(HEADER) $(STATIC) + $(CC) $(STRIPFLAGS) $(XCFLAGS) $(IATHEROS) -o $@ $< \ + $(STATIC) -L$(LIBOWLPS_DIR) -lowlps -lrt + +# Compilation de la bibliothèque statique +$(STATIC) : $(OBJS) + $(RM) $@ + $(AR) cru $@ $^ + $(RANLIB) $@ + + +## Nettoyage ## + +clean : + @$(RM) *~ *.o *.d + +purge : clean + @$(RM) $(STATIC) $(EXAMPLE) + + +## Aide ## + +help : + @make help + +# Local Variables: * +# mode: makefile-gmake * +# End: * diff --git a/libowlps/Makefile_drone b/libowlps/Makefile_drone index 64260c1..39a5805 100644 --- a/libowlps/Makefile_drone +++ b/libowlps/Makefile_drone @@ -19,9 +19,9 @@ AR = ar RANLIB = ranlib # Commandes d'installation et de désinstallation -RM=rm -fv -CP=cp -v -SYMLINK=ln -svf +RM = rm -f +CP = cp +SYMLINK = ln -sf # Variables générales LIB_CIBLE=libowlps @@ -38,7 +38,7 @@ HEADER=owlps.h OBJS=$(LIB_CIBLE).o # Flags -CFLAGS=-O2 -Wall -Wextra -Wstrict-prototypes -O -I. +CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -I. DEPFLAGS=-MMD XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) PICFLAG=-fPIC diff --git a/owlps-ardrone/Makefile_drone b/owlps-ardrone/Makefile_drone index 73af76c..86b8c43 100644 --- a/owlps-ardrone/Makefile_drone +++ b/owlps-ardrone/Makefile_drone @@ -30,8 +30,10 @@ 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$(LIBOWLPS_DIR) -I$(LIBOWLPSCLIENT_DIR) \ + -I$(LIBOWLPSRESULTREADER_DIR) #CFLAGS += -g -O0 DEPFLAGS = -MMD XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) @@ -41,7 +43,8 @@ OWLPSFLAGS += -D DEBUG LOWLPS = -L$(LIBOWLPS_DIR) -lowlps LOWLPSA = $(LIBOWLPS_DIR)/libowlps.a LOWLPSCLIENTA = $(LIBOWLPSCLIENT_DIR)/libowlps-client.a -LIBS = $(LOWLPSCLIENTA) -lrt -lm -pthread +LOWLPSRESULTREADERA = $(LIBOWLPSRESULTREADER_DIR)/libowlps-resultreader.a +LIBS = $(LOWLPSCLIENTA) $(LOWLPSRESULTREADERA) -lrt -lm -pthread DYNAMIC_LIBS = $(LOWLPS) $(LIBS) SEMISTATIC_LIBS = $(LOWLPSA) $(LIBS) STATIC_LIBS = $(LOWLPSA) $(LIBS) @@ -53,7 +56,8 @@ LDFLAGS = $(IATHEROS) $(LATHEROS) .PHONY: all semistatic static install uninstall clean purge help -semistatic: $(TARGET) +#dynamic: $(TARGET) +semistatic: $(TARGET).semistatic static: $(TARGET).static all: semistatic static @@ -67,6 +71,9 @@ all: semistatic static $(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)