Makefile 855 Bytes
Newer Older
Steve Arendt's avatar
Steve Arendt committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
###
#
# Makefile for Mock DTCP library customized for OCAP RI.
#
###

HOSTOS := $(shell uname -o)
export HOSTOS

ifeq ($(HOSTOS),Cygwin)
  CC = gcc-3 -mno-cygwin
  DLL_SUFFIX = dll
  MODULES_LINK_EXT = -lws2_32 -lwinmm
  LINK_PATHS = -Llib/win32
else ifeq ($(HOSTOS),GNU/Linux)
  CC = gcc
  DLL_SUFFIX = so
  LINK_PATHS = -Llib/linux
else
  $(error Unsupported OS.)
endif


DTCPIP_DLL ?= dtcpip_mock.$(DLL_SUFFIX)

MODULE_MOCKDLL = mockdll

MODULE_LINK_PFX = $(addprefix -l,mockdll)
MODULE_LINK = $(addprefix -l,$(MODULE_MOCKDLL))


default: all

$(MODULE_MOCKDLL):
	$(MAKE) -C _build build

all: $(MODULE_MOCKDLL)

build: $(MODULE_MOCKDLL)

shlib: build $(MODULE_MOCKDLL)
	$(CC) -shared -o $(DTCPIP_DLL) -Wl,--whole-archive -lmockdll $(LINK_PATHS) -Wl,--no-whole-archive $(MODULE_LINK_EXT)

clean:
	$(MAKE) -C _build clean 

purge:
	rm -f $(DTCPIP_DLL)