summaryrefslogtreecommitdiff
path: root/pjlib-util/build/Makefile
blob: a309b5ca78d0f077cea291925a03789afb601893 (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
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
#
# Include host/target/compiler selection.
# This will export CC_NAME, MACHINE_NAME, OS_NAME, and HOST_NAME variables.
#
include ../../build.mak

#
# Include global compiler specific definitions
#
include ../../build/cc-$(CC_NAME).mak

#
# (Optionally) Include compiler specific configuration that is
# specific to this project. This configuration file is
# located in this directory.
#
-include cc-$(CC_NAME).mak

#
# Include global machine specific definitions
#
include ../../build/m-$(MACHINE_NAME).mak
-include m-$(MACHINE_NAME).mak

#
# Include target OS specific definitions
#
include ../../build/os-$(OS_NAME).mak

#
# (Optionally) Include target OS specific configuration that is
# specific to this project. This configuration file is
# located in this directory.
#
-include os-$(OS_NAME).mak

#
# Include host specific definitions
#
include ../../build/host-$(HOST_NAME).mak

#
# (Optionally) Include host specific configuration that is
# specific to this project. This configuration file is
# located in this directory.
#
-include host-$(HOST_NAME).mak

#
# Include global user configuration, if any
#
-include ../../user.mak


RULES_MAK := ../../build/rules.mak

PJLIB_LIB:=../../pjlib/lib/libpj-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(LIBEXT)
export PJLIB_UTIL_LIB:=../lib/libpjlib-util-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(LIBEXT)

###############################################################################
# Gather all flags.
#
export _CFLAGS 	:= -O2 -g $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
		   $(CFLAGS) $(CC_INC)../include $(CC_INC)../../pjlib/include
export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
		   $(HOST_CXXFLAGS) $(CXXFLAGS)
export _LDFLAGS := $(subst /,$(HOST_PSEP),$(PJLIB_UTIL_LIB)) \
		   $(subst /,$(HOST_PSEP),$(PJLIB_LIB)) \
		   $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
		   $(LDFLAGS) 

###############################################################################
# Defines for building PJLIB library
#
export PJLIB_UTIL_SRCDIR = ../src/pjlib-util
export PJLIB_UTIL_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
		md5.o scanner.o stun.o stun_client.o xml.o
export PJLIB_UTIL_CFLAGS += $(_CFLAGS)

###############################################################################
# Defines for building test application
#
export UTIL_TEST_SRCDIR = ../src/pjlib-util-test
export UTIL_TEST_OBJS += xml.o test.o main.o
export UTIL_TEST_CFLAGS += $(_CFLAGS)
export UTIL_TEST_LDFLAGS += $(_LDFLAGS)
export UTIL_TEST_EXE:=../bin/pjlib-util-test-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(HOST_EXE)

	
export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT 
###############################################################################
# Main entry
#
# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
#
TARGETS := pjlib-util pjlib-util-test

all: $(TARGETS)

doc:
	cd .. && doxygen docs/doxygen.cfg

dep: depend
distclean: realclean

.PHONY: dep depend pjlib pjlib-test clean realclean distclean

pjlib-util:
	$(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $(PJLIB_UTIL_LIB)

pjlib-util-test: $(PJLIB_LIB)
	$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $(UTIL_TEST_EXE)

.PHONY: ../lib/pjlib-util.ko
../lib/pjlib-util.ko:
	echo Making $@
	$(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@

.PHONY: ../lib/pjlib-util-test.ko
../lib/pjlib-util-test.ko:
	$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@

clean depend realclean:
	$(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@
	$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
	@if test "$@" == "depend"; then \
	  echo '$(TEST_EXE): $(PJLIB_UTIL_LIB)' >> .pjlib-util-test-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME).depend; \
	fi