aboutsummaryrefslogtreecommitdiff
path: root/vendor/voclient/libsamp/libxrpc/Makefile
blob: 5fdf88f84e4d18178a9b94e6a990d373602f553c (plain) (blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#///////////////////////////////////////////////////////////////////////////////
#//
#//
#///////////////////////////////////////////////////////////////////////////////

# primary dependencies

NAME     	= xrpc
VERSION  	= 1.0
HERE    	:= $(shell /bin/pwd)
PLATFORM        := $(shell uname -s)
PLMACH          := $(shell uname -m)


# secondary dependencies

LIBBASE     = lib$(NAME)
STATICLIB   = $(HERE)/$(LIBBASE).a
SHAREDLIB   = $(HERE)/$(LIBBASE).so.$(VERSION)


# stuff that's precious to keep

.PRECIOUS:
.KEEP_STATE:


# includes, flags and libraries
CINCS   = -I./ -I./include -I../include -Ixmlrpc-c/lib/abyss/src
ifeq ($(PLATFORM),Darwin)
    ifeq ($(PLMACH),x86_64)
        CARCH   = -m64 -mmacosx-version-min=10.5
    else
        CARCH   = -arch i386 -m32 -mmacosx-version-min=10.4
    endif
    ifdef IRAFARCH
        ifeq ($(IRAFARCH),macintel)
            CARCH = -m64 -mmacosx-version-min=10.5
        else
            CARCH = -arch i386 -m32 -mmacosx-version-min=10.5
        endif
    endif
else
    CARCH       = 
endif

CFLAGS  = -O2 -Wall -g $(CINCS) $(CARCH)


# list of source and include files

SRCS  = xrClient.c xrServer.c xrMethod.c xrUtil.c xrStruct.c xrArray.c
OBJS  = xrClient.o xrServer.o xrMethod.o xrUtil.o xrStruct.o xrArray.o
INCS  = xrpc.h xrpcP.h


LFLAGS 	= -L. -L./lib 
LIBS 	=


# targets

all:  xrpc

clean:
	(./mkclean)
	/bin/rm -rf Shared Static UnitTests/* *.o *.a *.e

install: xrpc
	(cp libxrpc.a ../libsamp.a)
	mkdir -p ../../include/xmlrpc-c
	cp -p $(INCS)  ../../include
	cp -p ./include/xmlrpc*.h ../../include
	cp -p ./include/xmlrpc-c/*.h ../../include/xmlrpc-c
	cp -p ./include/xmlrpc-c/*.hpp ../../include/xmlrpc-c

World:
everything:
	make clean
	make xrpc
	make base
	make install

include:

#
base:
	(./mklibs)


xrpc: $(SRCS:%.c=%.o)
	cp $(OBJS) lib/build/
	/usr/bin/ar rv libxrpc.a $?
	(cp libxrpc.a ../libsamp.a)
	mkdir -p ../../include/xmlrpc-c
	cp -p $(INCS)  ../../include
	cp -p ./include/xmlrpc*.h ../../include
	cp -p ./include/xmlrpc-c/*.h ../../include/xmlrpc-c
	cp -p ./include/xmlrpc-c/*.hpp ../../include/xmlrpc-c

%.o: %.c $(INCS)
	/usr/bin/gcc -Wall $(CINCS) $(CFLAGS) -c $< -o $@


#=======================
# leave this stuff alone
#=======================

$(STATICLIB): $(SRCS:%.c=Static/%.o)
	/usr/bin/ar rv $@ $?
Static/%.o: %.c $(INCS)
	/usr/bin/gcc $(CINCS) $(CFLAGS) -c $< -o $@
Static:
	/bin/mkdir $@
	chmod 777 $@

$(SHAREDLIB): $(SRCS:%.c=Shared/%.o)
	/usr/bin/ld -shared -o $@ $? -lc -ldl
Shared/%.o: %.c $(INCS)
	/usr/bin/gcc $(CINCS) $(CFLAGS) -fpic -shared -c $< -o $@
Shared:
	/bin/mkdir $@
	chmod 777 $@