From 9ec71b800edb8d7a40a7897e1a22d5213b1701a5 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Wed, 9 May 2012 17:38:37 +0200 Subject: [PATCH] [lib*] Merge Makefile and Makefile_atheros_openwrt In libowlps and libowlps-client (libowlps-resultreader does not have an Atheros Makefile). --- Makefile_atheros_openwrt | 9 +- common.mk | 3 + libowlps-client/Makefile | 2 +- libowlps-client/Makefile_atheros_openwrt | 61 ------------- libowlps/Makefile | 6 +- libowlps/Makefile_atheros_openwrt | 106 ----------------------- 6 files changed, 12 insertions(+), 175 deletions(-) delete mode 100644 libowlps-client/Makefile_atheros_openwrt delete mode 100644 libowlps/Makefile_atheros_openwrt diff --git a/Makefile_atheros_openwrt b/Makefile_atheros_openwrt index c4685e8..a16eef8 100644 --- a/Makefile_atheros_openwrt +++ b/Makefile_atheros_openwrt @@ -25,13 +25,14 @@ all: \ owlps-listener libowlps: - @$(MAKE) $(TARGET) -f $(MAKEFILE) -C $@ + @$(MAKE) -C $@ $(TARGET) libowlps-client: libowlps - @$(MAKE) $(TARGET) -f $(MAKEFILE) -C $@ + @$(MAKE) -C $@ $(TARGET) + owlps-client: libowlps libowlps-client - @$(MAKE) $(TARGET) -f $(MAKEFILE) -C $@ + @$(MAKE) -f $(MAKEFILE) -C $@ $(TARGET) owlps-listener: libowlps libowlps-client - @$(MAKE) $(TARGET) -f $(MAKEFILE) -C $@ + @$(MAKE) -f $(MAKEFILE) -C $@ $(TARGET) ## Help ## diff --git a/common.mk b/common.mk index 697ae90..b44197f 100644 --- a/common.mk +++ b/common.mk @@ -102,6 +102,9 @@ ifdef OPENWRT_VERSION TOOLCHAIN2 := $(TOOLCHAIN_PREFIX)/target-mips_uClibc-0.9.30.1 endif + LATHEROS = -L$(TOOLCHAIN1)/lib -L$(TOOLCHAIN1)/usr/lib -L$(TOOLCHAIN2)/usr/lib + IATHEROS = -I$(TOOLCHAIN1)/usr/include -I$(TOOLCHAIN2)/usr/include + CC := STAGING_DIR=$(STAGING_DIR) $(TOOLCHAIN_BIN)/mips-openwrt-linux-gcc STRIP := STAGING_DIR=$(STAGING_DIR) $(TOOLCHAIN_BIN)/mips-openwrt-linux-strip -s endif diff --git a/libowlps-client/Makefile b/libowlps-client/Makefile index f983e98..baf8ed6 100644 --- a/libowlps-client/Makefile +++ b/libowlps-client/Makefile @@ -30,7 +30,7 @@ all : static static : $(STATIC) %.o : %.c $(HEADER) - $(CC) $(XCFLAGS) -c $< + $(CC) $(XCFLAGS) $(IATHEROS) -c $< # Static library compilation $(STATIC) : $(OBJS) diff --git a/libowlps-client/Makefile_atheros_openwrt b/libowlps-client/Makefile_atheros_openwrt deleted file mode 100644 index 72c8c59..0000000 --- a/libowlps-client/Makefile_atheros_openwrt +++ /dev/null @@ -1,61 +0,0 @@ -include ../common.mk - -# General variables -LIB_CIBLE=libowlps-client - -# Targets to build -STATIC=$(LIB_CIBLE).a -HEADER=owlps-client.h - -# Library components -OBJS=$(LIB_CIBLE).o - -# Flags -LIBOWLPS_DIR = ../libowlps -CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -I$(LIBOWLPS_DIR) -#CFLAGS += -g -O0 -CFLAGS += -D DEBUG -DEPFLAGS=-MMD -XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) -PICFLAG=-fPIC -#STRIPFLAGS= -Wl,-s -#LDFLAGS= -LATHEROS = -L$(TOOLCHAIN1)/lib -L$(TOOLCHAIN1)/usr/lib -L$(TOOLCHAIN2)/usr/lib -IATHEROS = -I$(TOOLCHAIN1)/usr/include -I$(TOOLCHAIN2)/usr/include - - -## Standard targets ## - -.PHONY : all static clean purge help - -all : static -static : $(STATIC) - -%.o : %.c $(HEADER) - $(CC) $(XCFLAGS) $(IATHEROS) -c $< - -# Static library compilation -$(STATIC) : $(OBJS) - $(RM) $@ - $(AR) cru $@ $^ - $(RANLIB) $@ - - -## Cleaning ## - -clean : - @$(RM) *~ *.o *.d - -purge : clean - @$(RM) $(STATIC) - - -## Help ## - -help : - @make help - - -# Local Variables: * -# mode: makefile-gmake * -# End: * diff --git a/libowlps/Makefile b/libowlps/Makefile index e6e0f7a..d5f887b 100644 --- a/libowlps/Makefile +++ b/libowlps/Makefile @@ -20,7 +20,7 @@ CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O DEPFLAGS=-MMD XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) PICFLAG=-fPIC -LIBS = +LIBS = -lc #STRIPFLAGS= -Wl,-s #LDFLAGS= @@ -34,11 +34,11 @@ dynamic : $(DYNAMIC) static : $(STATIC) %.o: %.c $(HEADER) - $(CC) $(XCFLAGS) $(PICFLAG) -c -o $@ $< + $(CC) $(XCFLAGS) $(IATHEROS) $(PICFLAG) -c -o $@ $< # Dynamic library compilation $(DYNAMIC): $(OBJS) - $(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) -lc $^ + $(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(IATHEROS) $(LATHEROS) $(LIBS) $^ $(SYMLINK) $@ $(LIB_CIBLE).so chmod a-x $@ diff --git a/libowlps/Makefile_atheros_openwrt b/libowlps/Makefile_atheros_openwrt deleted file mode 100644 index 72b73cc..0000000 --- a/libowlps/Makefile_atheros_openwrt +++ /dev/null @@ -1,106 +0,0 @@ -include ../common.mk - -# General variables -LIB_CIBLE=libowlps - -# Targets to build -STATIC=$(LIB_CIBLE).a -DYNAMIC=$(LIB_CIBLE).so.$(LIBOWLPS_VERSION) -#PROGS= -HEADER=owlps.h -#HEADERS= - -# Library components -OBJS=$(LIB_CIBLE).o - -# Flags -CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -#CFLAGS += -g -O0 -#CFLAGS += -D NDEBUG -DEPFLAGS=-MMD -XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) -PICFLAG=-fPIC -#STRIPFLAGS= -Wl,-s -#LDFLAGS= -LATHEROS = -L$(TOOLCHAIN1)/lib -L$(TOOLCHAIN1)/usr/lib -L$(TOOLCHAIN2)/usr/lib -IATHEROS = -I$(TOOLCHAIN1)/usr/include -I$(TOOLCHAIN2)/usr/include - -## Standard targets ## - -.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 $@ $< - -# Dynamic library compilation -$(DYNAMIC): $(OBJS) - $(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(IATHEROS) $(LATHEROS) $^ - $(SYMLINK) $@ $(LIB_CIBLE).so - chmod a-x $@ - -# Static library compilation -$(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) - - -## Uninstallation ## - -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) - - -## Cleaning ## - -clean : - @$(RM) *~ *.o *.d - -purge : clean - @$(RM) $(DYNAMIC) *.so $(STATIC) $(PROGS) - - -## Help ## - -help : - @make help - - -# Local Variables: * -# mode: makefile-gmake * -# End: *