# Export all variables by default export .PHONY : all dynamic semistatic static install install-dynamic install-static install-header uninstall uninstall-dynamic uninstall-static uninstall-header clean purge help test doc style check ### Versions ### # Current version of the libowlps LIBOWLPS_VERSION := 3.0 # OwlPS source version ifndef OWLPS_VERSION OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION') endif ### make-related variables ### # Default make command # Use MAKE=gmake on BSD systems. ifndef MAKE MAKE := make endif # Default Makefile name ifndef MAKEFILE MAKEFILE := Makefile endif # Default target to call, when calling a Makefile from another Makefile ifndef TARGET TARGET := all endif # Target architecture # This is unused for now. ifndef ARCH ARCH := native endif ### Building tools ### # Misc tools AR := ar RANLIB := ranlib STRIP := strip -s # Install/uninstall commands CP := cp MKDIR := mkdir -p RM := rm -f RM_RECURSIVE := \rm -fr SYMLINK := ln -sf # C compiler ifeq "$(origin CC)" "default" CLANG := $(shell command -v clang >/dev/null ; echo $$?) ifeq "$(CLANG)" "0" CC := clang else COLORGCC := $(shell command -v colorgcc >/dev/null ; echo $$?) ifeq "$(COLORGCC)" "0" CC := colorgcc endif endif endif # C++ compiler ifeq "$(origin CXX)" "default" COLORGCC := $(shell which colorgcc >/dev/null 2>&1 ; echo $$?) ifeq "$(COLORGCC)" "0" CXX := colorgcc endif endif ### OwlPS-specific variables ### LIBOWLPS_DIR = ../libowlps LIBOWLPSCLIENT_DIR = ../libowlps-client LIBOWLPSRESULTREADER_DIR = ../libowlps-resultreader ### Build flags ### # Reinitialisation CPPFLAGS := CFLAGS := CXXFLAGS := LDFLAGS := ## OpenWrt specifics ## # # To compile for OpenWrt, the OPENWRT_VERSION variable must be set. # # By default (i.e. if OPENWRT_VERSION is set to something else than a # known version number, we assume compiling for trunk. For this to # work we advise that you do something like that (assuming the OpenWrt # builroot is installed in ~/openwrt/buildroot): # mkdir -p ~/openwrt/atheros/trunk # cd ~/openwrt/atheros/trunk # ln -s ../../buildroot/staging_dir # ln -s \ # ../../buildroot/staging_dir/target-mips_uClibc-0.9.33 \ # target-mips_uClibc # ln -s \ # ../../buildroot/staging_dir/toolchain-mips_gcc-4.6-linaro_uClibc-0.9.33/ \ # toolchain-mips_gcc_uClibc # Of course, you have to update the symlinks when you compile a new # version of the SDK. ifdef OPENWRT_VERSION TOOLCHAIN_PREFIX := $${HOME}/openwrt/atheros/trunk STAGING_DIR := $(TOOLCHAIN_PREFIX)/staging_dir TOOLCHAIN1 := $(TOOLCHAIN_PREFIX)/toolchain-mips_gcc_uClibc TOOLCHAIN_BIN := $(TOOLCHAIN1)/bin TOOLCHAIN2 := $(TOOLCHAIN_PREFIX)/target-mips_uClibc ifeq "$(OPENWRT_VERSION)" "10.03" TOOLCHAIN_PREFIX := $${HOME}/openwrt/atheros/10.03/staging_dir STAGING_DIR := $(TOOLCHAIN_PREFIX) TOOLCHAIN1 := $(TOOLCHAIN_PREFIX)/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1 TOOLCHAIN_BIN := $(TOOLCHAIN1)/usr/bin TOOLCHAIN2 := $(TOOLCHAIN_PREFIX)/target-mips_uClibc-0.9.30.1 endif CFLAGS += -I$(TOOLCHAIN1)/usr/include -I$(TOOLCHAIN2)/usr/include LDFLAGS += -L$(TOOLCHAIN1)/lib -L$(TOOLCHAIN1)/usr/lib -L$(TOOLCHAIN2)/usr/lib DYNAMIC_LDFLAGS += $(TOOLCHAIN1)/lib/ld-uClibc.so.0 SEMISTATIC_LDFLAGS += $(TOOLCHAIN1)/lib/ld-uClibc.so.0 CC := STAGING_DIR=$(STAGING_DIR) $(TOOLCHAIN_BIN)/mips-openwrt-linux-gcc STRIP := STAGING_DIR=$(STAGING_DIR) $(TOOLCHAIN_BIN)/mips-openwrt-linux-strip -s endif # OwlPS flags CFLAGS += -D OWLPS_VERSION=\"$(OWLPS_VERSION)\" LDFLAGS += -L$(LIBOWLPS_DIR) -L$(LIBOWLPSCLIENT_DIR) -L$(LIBOWLPSRESULTREADER_DIR) CFLAGS += -I$(LIBOWLPS_DIR) -I$(LIBOWLPSCLIENT_DIR) -I$(LIBOWLPSRESULTREADER_DIR) # Options CFLAGS += -O2 CFLAGS += -fPIC CFLAGS += -Wall -Wextra # Debug flags CFLAGS += -D DEBUG #CFLAGS += -g -O0 #CFLAGS += -D NDEBUG # Misc #STRIPFLAGS += -Wl,-s # OS specific flags ifeq "$(OS)" "DragonFly" CFLAGS += -I/usr/pkg/include LDFLAGS += -L/usr/pkg/lib endif ifeq "$(OS)" "NetBSD" CFLAGS += -I/usr/pkg/include LDFLAGS += -L/usr/pkg/lib endif ifeq "$(OS)" "OpenBSD" CFLAGS += -I/usr/local/include LDFLAGS += -L/usr/local/lib endif # C++ specific flags CXXFLAGS := $(CFLAGS) # C specific flags CFLAGS += -Wstrict-prototypes ### Installation directories ### PREFIX := /usr/local INSTALL_DIR := $(PREFIX)/bin INSTALL_LIB := $(PREFIX)/lib INSTALL_INC := $(PREFIX)/include INSTALL_MAN := $(PREFIX)/share/man