120 lines
2.9 KiB
Makefile
120 lines
2.9 KiB
Makefile
# Export all variables by default
|
|
export
|
|
|
|
### 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"
|
|
COLORGCC := $(shell which colorgcc >/dev/null 2>&1 ; echo $$?)
|
|
ifeq "$(COLORGCC)" "0"
|
|
CC := colorgcc
|
|
endif
|
|
endif
|
|
|
|
# C++ compiler
|
|
ifeq "$(origin CXX)" "default"
|
|
COLORGCC := $(shell which colorgcc >/dev/null 2>&1 ; echo $$?)
|
|
ifeq "$(COLORGCC)" "0"
|
|
CXX := colorgcc
|
|
endif
|
|
endif
|
|
|
|
|
|
### 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
|
|
# 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
|
|
|
|
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
|
|
|
|
|
|
### Installation directories ###
|
|
|
|
PREFIX := /usr/local
|
|
INSTALL_DIR := $(PREFIX)/bin
|
|
INSTALL_LIB := $(PREFIX)/lib
|
|
INSTALL_INC := $(PREFIX)/include
|
|
INSTALL_MAN := $(PREFIX)/share/man
|