summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 639e27e88cd601a7e21dad5bc77bf8c2809ba77a (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
############################################################################
#                                                                          #
# Description : Agent proxy                                                #
#                                                                          #
# Copyright (c) 2005-2010 Wind River Systems Inc. All rights reserved      #
# Original design by Jason Wessel                                          #
############################################################################

AGENTVER=1.97

ifeq ($(shell uname -s),Linux) 
OSTYPE := linux
endif

ifeq ($(findstring solaris,$(OSTYPE)),solaris)
ARCH := solaris
LDLIBS = -lnsl -lsocket
endif

ifeq ($(findstring linux,$(OSTYPE)),linux)
ARCH := linux
endif

OBJS = agent-proxy.o agent-proxy-rs232.o
SRCS = $(patsubst %.o,%.c,$(OBJS))
OBJS := $(patsubst %.o,$(CROSS_COMPILE)%.o,$(OBJS))
ifneq ($(extpath),)
OBJS := $(patsubst %.o,$(extpath)%.o,$(OBJS))
endif

## Windows options ##
ifeq ($(ARCH),)
CFLAGS = /GZ /Z7 /MTd -DDEBUG -nologo
LINKFLAGS = 
CC = cl
#Change .o to .obj
OBJS:=$(patsubst %.o,%.obj,$(OBJS))
TLSPATH_INC=-I T:/rome_tls/x86-win/encap/sdk0204/include
## Unix Options ##
else
CFLAGS = -g -Wall -Wno-unused-parameter -D$(ARCH)
CC = $(CROSS_COMPILE)gcc
AGENTPROXY = $(CROSS_COMPILE)agent-proxy
endif

all: $(CROSS_COMPILE)agent-proxy

## Build for win32 or unix
ifeq ($(ARCH),)
$(CROSS_COMPILE)agent-proxy: $(OBJS)
	$(CC) -DAGENT_VER=$(AGENTVER) $(LINKFLAGS) $(CFLAGS) -o $(extpath)$@ $(OBJS) wsock32.lib
else
$(CROSS_COMPILE)agent-proxy: $(OBJS)
	$(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) -o $(extpath)$@ $(OBJS) $(LDLIBS)
endif


distclean: clean
	rm -f $(extpath).depend $(extpath).depend.bak $(extpath)*~ $(extpath)*.bak
clean:
	rm -f $(extpath)$(CROSS_COMPILE)agent-proxy $(extpath)agent-proxy $(extpath)*.o $(extpath)*.obj $(extpath)*.exp $(extpath)*.exe $(extpath)*.ilk $(extpath)*.pdb *~

$(extpath)$(CROSS_COMPILE)%.o::%.c
	$(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) -c $< -o $@

$(extpath)%.obj:%.c
	$(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) -c -Fo$@ $(TLSPATH_INC) $<