aboutsummaryrefslogtreecommitdiff
path: root/vendor/voclient/libsamp/examples/Makefile
blob: 9096b9359bb8c1ebd8b69dabe78329385ac83811 (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#///////////////////////////////////////////////////////////////////////////////
#//
#//  Makefile for the libsamp example tasks.
#//
#///////////////////////////////////////////////////////////////////////////////

# primary dependencies

NAME       	= samp
VERSION    	= 1.0
PLATFORM       := $(shell uname -s)
PLMACH         := $(shell ../../getarch)
HERE           := $(shell /bin/pwd)


# secondary dependencies

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


# stuff that's precious to keep

.PRECIOUS:	$(STATICLIB) $(SHAREDLIB)
.KEEP_STATE:


# includes, flags and libraries
CC 	    = gcc
CINCS  	    = -I$(HERE) -I../ -I../../include -L../ -L../../lib/ -L../
CFLAGS 	    = -g -Wall -D$(PLATFORM) $(CINCS)

ifeq ("$(PLATFORM)", "Darwin")
    ifeq  ("$(PLMACH)", "macintel")
        CARCH   = -m64 -mmacosx-version-min=10.5
    else
        CARCH   = -arch i386 -arch ppc -m32 -mmacosx-version-min=10.4
    endif
else
    CLIBS       = -lm -lc -lpthread -lcurl
    CARCH       = -D$(PLATFORM)
endif

#CARCH   	= -arch i386 -arch ppc -m32 -mmacosx-version-min=10.4
CLIBS           = -lm -lc -lcurl -lpthread
CFLAGS          = -g -Wall $(CARCH) -D$(PLATFORM) $(CINCS) -L./




#F77 	    = g77
F77 	    = gfortran
FFLAGS 	    = -g -Wall



# list of source and include files

C_SRCS 	    = snoop.c send.c
C_OBJS 	    =
C_INCS 	    =  

F77_SRCS    = 
F77_OBJS    = 
F77_INCS    =  

SPP_SRCS    = 
SPP_OBJS    = 
SPP_INCS    = 


LIBS 	    = -lsamp -lcurl

SPP_TASKS   = 
F77_TASKS   = 
C_TASKS	    = snoop send
	      
TARGETS	    = $(F77_TASKS) $(SPP_TASKS) $(C_TASKS)


# Targets

all: $(TARGETS)

c_progs:    $(C_TASKS)
spp_progs:  $(SPP_TASKS)
f77_progs:  $(F77_TASKS)

clean:
	/bin/rm -rf .make.state .nse_depinfo *.[aeo] *.dSYM
	/bin/rm -rf $(TARGETS)

everything:
	make clean
	make all
	make install

help: HELP

install: all 



###############################################################################
# Unit test programs to be built.
###############################################################################

demo:	$(TARGETS)


###########################
#  C Test programs
###########################

zztest:  zztest.c
	$(CC) $(CFLAGS) -o zztest zztest.c $(LIBS)

snoop:	snoop.c ../libsamp.a
	$(CC) $(CFLAGS) -o snoop snoop.c $(LIBS)

send:	send.c ../libsamp.a
	$(CC) $(CFLAGS) -o send send.c $(LIBS)



###########################
#  SPP Test programs
###########################

#foo_spp:  foo_spp.x
#	xc -/I../ -/L../ foo_spp.x -lsamp



###########################
#  Fortran Test programs.
###########################

#foo_f77:  foo_f77.f
#	$(F77) $(FFLAGS) -o foo_f77 foo_f77.f ../libsamp.a -lc




###############################################################################
# Leave this stuff alone.
###############################################################################

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

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