xref: /unit/auto/make (revision 1996:35873fa78fed)
10Sigor@sysoev.ru
20Sigor@sysoev.ru# Copyright (C) Igor Sysoev
30Sigor@sysoev.ru# Copyright (C) Valentin V. Bartenev
40Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
50Sigor@sysoev.ru
6396Smax.romanov@nginx.com. auto/cc/deps
70Sigor@sysoev.ru
80Sigor@sysoev.ru$echo "creating $NXT_MAKEFILE"
90Sigor@sysoev.ru
100Sigor@sysoev.rumkdir -p $NXT_BUILD_DIR/src \
11384Szelenkov@nginx.com         $NXT_BUILD_DIR/src/test
120Sigor@sysoev.ru
130Sigor@sysoev.ru
140Sigor@sysoev.rucat << END > $NXT_MAKEFILE
150Sigor@sysoev.ru
160Sigor@sysoev.ruCC =			$CC
171255Svbart@nginx.comAR =			$AR
180Sigor@sysoev.ru
193Sigor@sysoev.ruCFLAGS = 		$NXT_CFLAGS $NXT_CC_OPT $CFLAGS
200Sigor@sysoev.ru
210Sigor@sysoev.ruNXT_EXEC_LINK =		$NXT_EXEC_LINK $NXT_LD_OPT
220Sigor@sysoev.ruNXT_SHARED_LOCAL_LINK =	$NXT_SHARED_LOCAL_LINK $NXT_LD_OPT
23395Smax.romanov@nginx.comNXT_MODULE_LINK =	$NXT_MODULE_LINK
240Sigor@sysoev.ru
251825Sthresh@nginx.comall: $NXT_DAEMON manpage
26698Smax.romanov@nginx.com
271825Sthresh@nginx.com.PHONY: $NXT_DAEMON manpage
28265Smax.romanov@nginx.com$NXT_DAEMON: $NXT_BUILD_DIR/$NXT_DAEMON
291825Sthresh@nginx.commanpage: $NXT_BUILD_DIR/unitd.8
30216Sigor@sysoev.ru
310Sigor@sysoev.ruEND
320Sigor@sysoev.ru
330Sigor@sysoev.ru
340Sigor@sysoev.ru# The include paths list.
350Sigor@sysoev.ru
360Sigor@sysoev.ru$echo -n "NXT_LIB_INCS =" >> $NXT_MAKEFILE
370Sigor@sysoev.ru
380Sigor@sysoev.rufor nxt_inc in src $NXT_BUILD_DIR
390Sigor@sysoev.rudo
400Sigor@sysoev.ru    $echo -n " -I $nxt_inc" >> $NXT_MAKEFILE
410Sigor@sysoev.rudone
420Sigor@sysoev.ru
430Sigor@sysoev.ru$echo >> $NXT_MAKEFILE
440Sigor@sysoev.ru$echo >> $NXT_MAKEFILE
450Sigor@sysoev.ru
460Sigor@sysoev.ru
470Sigor@sysoev.ru# Library object files list.
480Sigor@sysoev.ru
490Sigor@sysoev.ru$echo "NXT_LIB_OBJS = \\" >> $NXT_MAKEFILE
500Sigor@sysoev.ru
510Sigor@sysoev.rufor nxt_src in $NXT_LIB_SRCS
520Sigor@sysoev.rudo
53396Smax.romanov@nginx.com    nxt_obj=${nxt_src%.c}.o
540Sigor@sysoev.ru    $echo "	$NXT_BUILD_DIR/$nxt_obj \\" >> $NXT_MAKEFILE
550Sigor@sysoev.rudone
560Sigor@sysoev.ru
570Sigor@sysoev.ru$echo >> $NXT_MAKEFILE
580Sigor@sysoev.ru
59743Smax.romanov@nginx.com$echo "NXT_LIB_UNIT_OBJS = \\" >> $NXT_MAKEFILE
60743Smax.romanov@nginx.com$echo "	$NXT_BUILD_DIR/src/nxt_lvlhsh.o \\" >> $NXT_MAKEFILE
61743Smax.romanov@nginx.com$echo "	$NXT_BUILD_DIR/src/nxt_murmur_hash.o \\" >> $NXT_MAKEFILE
62*1996St.nateldemoura@f5.com$echo "	$NXT_BUILD_DIR/src/nxt_socket_msg.o \\" >> $NXT_MAKEFILE
631131Smax.romanov@nginx.com$echo "	$NXT_BUILD_DIR/src/nxt_websocket.o \\" >> $NXT_MAKEFILE
64743Smax.romanov@nginx.com
65743Smax.romanov@nginx.comfor nxt_src in $NXT_LIB_UNIT_SRCS
66743Smax.romanov@nginx.comdo
67743Smax.romanov@nginx.com    nxt_obj=${nxt_src%.c}.o
68743Smax.romanov@nginx.com    $echo "	$NXT_BUILD_DIR/$nxt_obj \\" >> $NXT_MAKEFILE
69743Smax.romanov@nginx.comdone
70743Smax.romanov@nginx.com
71743Smax.romanov@nginx.com$echo >> $NXT_MAKEFILE
72743Smax.romanov@nginx.com
730Sigor@sysoev.ru
74953Salexander.borisov@nginx.com# The version file.
75953Salexander.borisov@nginx.com
76953Salexander.borisov@nginx.comcat << END >> $NXT_MAKEFILE
77953Salexander.borisov@nginx.com
78953Salexander.borisov@nginx.cominclude version
79953Salexander.borisov@nginx.com
80953Salexander.borisov@nginx.com$NXT_VERSION_H: version
81953Salexander.borisov@nginx.com	$echo '#define NXT_VERSION "\$(NXT_VERSION)"' > $NXT_VERSION_H
82953Salexander.borisov@nginx.com	$echo '#define NXT_VERNUM  \$(NXT_VERNUM)' >> $NXT_VERSION_H
83953Salexander.borisov@nginx.com
84953Salexander.borisov@nginx.comEND
85953Salexander.borisov@nginx.com
86953Salexander.borisov@nginx.com
870Sigor@sysoev.ru# Shared and static library.
880Sigor@sysoev.ru
890Sigor@sysoev.rucat << END >> $NXT_MAKEFILE
900Sigor@sysoev.ru
910Sigor@sysoev.rulibnxt:	$NXT_BUILD_DIR/$NXT_LIB_SHARED $NXT_BUILD_DIR/$NXT_LIB_STATIC
920Sigor@sysoev.ru
930Sigor@sysoev.ru$NXT_BUILD_DIR/$NXT_LIB_SHARED:	\$(NXT_LIB_OBJS)
940Sigor@sysoev.ru	\$(NXT_SHARED_LOCAL_LINK) -o $NXT_BUILD_DIR/$NXT_LIB_SHARED \\
950Sigor@sysoev.ru		\$(NXT_LIB_OBJS) \\
960Sigor@sysoev.ru		$NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
970Sigor@sysoev.ru
980Sigor@sysoev.ru$NXT_BUILD_DIR/$NXT_LIB_STATIC:	\$(NXT_LIB_OBJS)
990Sigor@sysoev.ru	$NXT_STATIC_LINK $NXT_BUILD_DIR/$NXT_LIB_STATIC \\
1000Sigor@sysoev.ru		\$(NXT_LIB_OBJS)
1010Sigor@sysoev.ru
102743Smax.romanov@nginx.com$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC:	\$(NXT_LIB_UNIT_OBJS)
103743Smax.romanov@nginx.com	$NXT_STATIC_LINK $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\
104743Smax.romanov@nginx.com		\$(NXT_LIB_UNIT_OBJS)
105743Smax.romanov@nginx.com
1060Sigor@sysoev.ruEND
1070Sigor@sysoev.ru
1080Sigor@sysoev.ru
1090Sigor@sysoev.ru# Object files.
1100Sigor@sysoev.ru
111743Smax.romanov@nginx.comfor nxt_src in $NXT_LIB_SRCS $NXT_TEST_SRCS $NXT_LIB_UNIT_SRCS \
1121131Smax.romanov@nginx.com               src/test/nxt_unit_app_test.c \
1131131Smax.romanov@nginx.com               src/test/nxt_unit_websocket_chat.c \
1141131Smax.romanov@nginx.com               src/test/nxt_unit_websocket_echo.c
1150Sigor@sysoev.rudo
116396Smax.romanov@nginx.com    nxt_obj=${nxt_src%.c}.o
117396Smax.romanov@nginx.com    nxt_dep=${nxt_src%.c}.dep
118396Smax.romanov@nginx.com    nxt_dep_flags=`nxt_gen_dep_flags`
119396Smax.romanov@nginx.com    nxt_dep_post=`nxt_gen_dep_post`
1200Sigor@sysoev.ru    cat << END >> $NXT_MAKEFILE
1210Sigor@sysoev.ru
1221217Smax.romanov@nginx.com$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
1230Sigor@sysoev.ru	\$(CC) -c \$(CFLAGS) \$(NXT_LIB_INCS) $NXT_LIB_AUX_CFLAGS \\
1240Sigor@sysoev.ru	-o $NXT_BUILD_DIR/$nxt_obj \\
125396Smax.romanov@nginx.com	$nxt_dep_flags \\
1260Sigor@sysoev.ru	$nxt_src
127396Smax.romanov@nginx.com	$nxt_dep_post
128396Smax.romanov@nginx.com
129396Smax.romanov@nginx.com-include $NXT_BUILD_DIR/$nxt_dep
130396Smax.romanov@nginx.com
1310Sigor@sysoev.ruEND
1320Sigor@sysoev.ru
1330Sigor@sysoev.rudone
1340Sigor@sysoev.ru
1351554Smax.romanov@nginx.comnxt_src=src/test/nxt_cq_test.c
1361554Smax.romanov@nginx.comnxt_obj=src/test/nxt_ncq_test.o
1371554Smax.romanov@nginx.comnxt_dep=src/test/nxt_ncq_test.dep
1381554Smax.romanov@nginx.comnxt_dep_flags=`nxt_gen_dep_flags`
1391554Smax.romanov@nginx.comnxt_dep_post=`nxt_gen_dep_post`
1401554Smax.romanov@nginx.comcat << END >> $NXT_MAKEFILE
1411554Smax.romanov@nginx.com
1421554Smax.romanov@nginx.com$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
1431554Smax.romanov@nginx.com	\$(CC) -c \$(CFLAGS) -DNXT_NCQ_TEST=1 \$(NXT_LIB_INCS) $NXT_LIB_AUX_CFLAGS \\
1441554Smax.romanov@nginx.com	-o $NXT_BUILD_DIR/$nxt_obj \\
1451554Smax.romanov@nginx.com	$nxt_dep_flags \\
1461554Smax.romanov@nginx.com	$nxt_src
1471554Smax.romanov@nginx.com	$nxt_dep_post
1481554Smax.romanov@nginx.com
1491554Smax.romanov@nginx.com-include $NXT_BUILD_DIR/$nxt_dep
1501554Smax.romanov@nginx.com
1511554Smax.romanov@nginx.comEND
1521554Smax.romanov@nginx.com
1531554Smax.romanov@nginx.comnxt_src=src/test/nxt_cq_test.c
1541554Smax.romanov@nginx.comnxt_obj=src/test/nxt_vbcq_test.o
1551554Smax.romanov@nginx.comnxt_dep=src/test/nxt_vbcq_test.dep
1561554Smax.romanov@nginx.comnxt_dep_flags=`nxt_gen_dep_flags`
1571554Smax.romanov@nginx.comnxt_dep_post=`nxt_gen_dep_post`
1581554Smax.romanov@nginx.comcat << END >> $NXT_MAKEFILE
1591554Smax.romanov@nginx.com
1601554Smax.romanov@nginx.com$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
1611554Smax.romanov@nginx.com	\$(CC) -c \$(CFLAGS) -DNXT_NCQ_TEST=0 \$(NXT_LIB_INCS) $NXT_LIB_AUX_CFLAGS \\
1621554Smax.romanov@nginx.com	-o $NXT_BUILD_DIR/$nxt_obj \\
1631554Smax.romanov@nginx.com	$nxt_dep_flags \\
1641554Smax.romanov@nginx.com	$nxt_src
1651554Smax.romanov@nginx.com	$nxt_dep_post
1661554Smax.romanov@nginx.com
1671554Smax.romanov@nginx.com-include $NXT_BUILD_DIR/$nxt_dep
1681554Smax.romanov@nginx.com
1691554Smax.romanov@nginx.comEND
1701554Smax.romanov@nginx.com
1710Sigor@sysoev.ru$echo >> $NXT_MAKEFILE
1720Sigor@sysoev.ru
1730Sigor@sysoev.ru
174752Svbart@nginx.comif [ $NXT_TESTS = YES ]; then
1750Sigor@sysoev.ru
176752Svbart@nginx.com    # Test object files list.
177752Svbart@nginx.com
178752Svbart@nginx.com    $echo "NXT_TEST_OBJS = \\" >> $NXT_MAKEFILE
1790Sigor@sysoev.ru
180752Svbart@nginx.com    for nxt_src in $NXT_TEST_SRCS
181752Svbart@nginx.com    do
182752Svbart@nginx.com        nxt_obj=${nxt_src%.c}.o
183752Svbart@nginx.com        $echo "	$NXT_BUILD_DIR/$nxt_obj \\" >> $NXT_MAKEFILE
184752Svbart@nginx.com    done
1850Sigor@sysoev.ru
186752Svbart@nginx.com    # Test executables.
1870Sigor@sysoev.ru
188752Svbart@nginx.com    cat << END >> $NXT_MAKEFILE
1890Sigor@sysoev.ru
190752Svbart@nginx.com.PHONY: tests
191752Svbart@nginx.comtests:		$NXT_BUILD_DIR/tests $NXT_BUILD_DIR/utf8_file_name_test \\
1921554Smax.romanov@nginx.com			$NXT_BUILD_DIR/ncq_test \\
1931554Smax.romanov@nginx.com			$NXT_BUILD_DIR/vbcq_test \\
1941131Smax.romanov@nginx.com			$NXT_BUILD_DIR/unit_app_test $NXT_BUILD_DIR/unit_websocket_chat \\
1951131Smax.romanov@nginx.com			$NXT_BUILD_DIR/unit_websocket_echo
1960Sigor@sysoev.ru
197246Sigor@sysoev.ru$NXT_BUILD_DIR/tests: \$(NXT_TEST_OBJS) \\
198396Smax.romanov@nginx.com			$NXT_BUILD_DIR/$NXT_LIB_STATIC
199246Sigor@sysoev.ru	\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/tests \\
200246Sigor@sysoev.ru		\$(CFLAGS) \$(NXT_TEST_OBJS) \\
2010Sigor@sysoev.ru		$NXT_BUILD_DIR/$NXT_LIB_STATIC \\
2020Sigor@sysoev.ru		$NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
2030Sigor@sysoev.ru
2040Sigor@sysoev.ru$NXT_BUILD_DIR/utf8_file_name_test: $NXT_LIB_UTF8_FILE_NAME_TEST_SRCS \\
205396Smax.romanov@nginx.com			$NXT_BUILD_DIR/$NXT_LIB_STATIC
2060Sigor@sysoev.ru	\$(CC) \$(CFLAGS) \$(NXT_LIB_INCS) $NXT_LIB_AUX_CFLAGS \\
2070Sigor@sysoev.ru		-o $NXT_BUILD_DIR/utf8_file_name_test \\
2080Sigor@sysoev.ru		$NXT_LIB_UTF8_FILE_NAME_TEST_SRCS \\
2090Sigor@sysoev.ru		$NXT_BUILD_DIR/$NXT_LIB_STATIC \\
210771Sigor@sysoev.ru		$NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
2110Sigor@sysoev.ru
2121554Smax.romanov@nginx.com$NXT_BUILD_DIR/ncq_test: $NXT_BUILD_DIR/src/test/nxt_ncq_test.o \\
2131554Smax.romanov@nginx.com			$NXT_BUILD_DIR/$NXT_LIB_STATIC
2141554Smax.romanov@nginx.com	\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/ncq_test \\
2151554Smax.romanov@nginx.com		\$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_ncq_test.o \\
2161554Smax.romanov@nginx.com		$NXT_BUILD_DIR/$NXT_LIB_STATIC \\
2171554Smax.romanov@nginx.com		$NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
2181554Smax.romanov@nginx.com
2191554Smax.romanov@nginx.com$NXT_BUILD_DIR/vbcq_test: $NXT_BUILD_DIR/src/test/nxt_vbcq_test.o \\
2201554Smax.romanov@nginx.com			$NXT_BUILD_DIR/$NXT_LIB_STATIC
2211554Smax.romanov@nginx.com	\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/vbcq_test \\
2221554Smax.romanov@nginx.com		\$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_vbcq_test.o \\
2231554Smax.romanov@nginx.com		$NXT_BUILD_DIR/$NXT_LIB_STATIC \\
2241554Smax.romanov@nginx.com		$NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
2251554Smax.romanov@nginx.com
226743Smax.romanov@nginx.com$NXT_BUILD_DIR/unit_app_test: $NXT_BUILD_DIR/src/test/nxt_unit_app_test.o \\
227743Smax.romanov@nginx.com		$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC
228743Smax.romanov@nginx.com	\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/unit_app_test \\
229743Smax.romanov@nginx.com		\$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_unit_app_test.o \\
230743Smax.romanov@nginx.com		$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\
231743Smax.romanov@nginx.com		$NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
232743Smax.romanov@nginx.com
2331131Smax.romanov@nginx.com$NXT_BUILD_DIR/unit_websocket_chat: \\
2341131Smax.romanov@nginx.com		$NXT_BUILD_DIR/src/test/nxt_unit_websocket_chat.o \\
2351131Smax.romanov@nginx.com		$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC
2361131Smax.romanov@nginx.com	\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/unit_websocket_chat \\
2371131Smax.romanov@nginx.com		\$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_unit_websocket_chat.o \\
2381131Smax.romanov@nginx.com		$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\
2391131Smax.romanov@nginx.com		$NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
2401131Smax.romanov@nginx.com
2411131Smax.romanov@nginx.com$NXT_BUILD_DIR/unit_websocket_echo: \\
2421131Smax.romanov@nginx.com		$NXT_BUILD_DIR/src/test/nxt_unit_websocket_echo.o \\
2431131Smax.romanov@nginx.com		$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC
2441131Smax.romanov@nginx.com	\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/unit_websocket_echo \\
2451131Smax.romanov@nginx.com		\$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_unit_websocket_echo.o \\
2461131Smax.romanov@nginx.com		$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\
2471131Smax.romanov@nginx.com		$NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
2481131Smax.romanov@nginx.com
2490Sigor@sysoev.ruEND
2500Sigor@sysoev.ru
251752Svbart@nginx.comelse
252752Svbart@nginx.com
253752Svbart@nginx.com    cat << END >> $NXT_MAKEFILE
254752Svbart@nginx.com
255752Svbart@nginx.com.PHONY: tests
256752Svbart@nginx.comtests:
257752Svbart@nginx.com	@(echo; \\
258752Svbart@nginx.com	  echo "error: to make tests you need to configure --tests option."; \\
259752Svbart@nginx.com	  echo; \\
260752Svbart@nginx.com	  exit 1)
261752Svbart@nginx.com
262752Svbart@nginx.comEND
263752Svbart@nginx.com
264752Svbart@nginx.comfi
265752Svbart@nginx.com
2660Sigor@sysoev.ru
2670Sigor@sysoev.ruNXT_MAKE_INCS="src $NXT_BUILD_DIR"
2680Sigor@sysoev.ruNXT_MAKE_SRCS="$NXT_SRCS"
2690Sigor@sysoev.ru
2700Sigor@sysoev.ru
271762Svbart@nginx.com# The include paths list.
2720Sigor@sysoev.ru
2730Sigor@sysoev.ru$echo -n "NXT_INCS =" >> $NXT_MAKEFILE
2740Sigor@sysoev.ru
2750Sigor@sysoev.rufor nxt_inc in $NXT_MAKE_INCS
2760Sigor@sysoev.rudo
2770Sigor@sysoev.ru    $echo -n " -I $nxt_inc" >> $NXT_MAKEFILE
2780Sigor@sysoev.rudone
2790Sigor@sysoev.ru
2800Sigor@sysoev.ru$echo >> $NXT_MAKEFILE
2810Sigor@sysoev.ru$echo >> $NXT_MAKEFILE
2820Sigor@sysoev.ru
2830Sigor@sysoev.ru
2840Sigor@sysoev.ru# Object files list.
2850Sigor@sysoev.ru
2860Sigor@sysoev.ru$echo "NXT_OBJS = \\" >> $NXT_MAKEFILE
2870Sigor@sysoev.ru
288216Sigor@sysoev.rufor nxt_src in $NXT_MAKE_SRCS
2890Sigor@sysoev.rudo
290396Smax.romanov@nginx.com    nxt_obj=${nxt_src%.c}.o
2910Sigor@sysoev.ru    $echo "	$NXT_BUILD_DIR/$nxt_obj \\" >> $NXT_MAKEFILE
2920Sigor@sysoev.rudone
2930Sigor@sysoev.ru
2940Sigor@sysoev.ru$echo >> $NXT_MAKEFILE
2950Sigor@sysoev.ru
2960Sigor@sysoev.ru
297259Sigor@sysoev.ru# unit executable.
2980Sigor@sysoev.ru
2990Sigor@sysoev.rucat << END >> $NXT_MAKEFILE
3000Sigor@sysoev.ru
301265Smax.romanov@nginx.com$NXT_BUILD_DIR/$NXT_DAEMON:	$NXT_BUILD_DIR/$NXT_LIB_STATIC \\
3020Sigor@sysoev.ru				\$(NXT_OBJS)
303265Smax.romanov@nginx.com	\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/$NXT_DAEMON \$(CFLAGS) \\
3040Sigor@sysoev.ru		\$(NXT_OBJS) $NXT_BUILD_DIR/$NXT_LIB_STATIC \\
3050Sigor@sysoev.ru		$NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
3060Sigor@sysoev.ru
3070Sigor@sysoev.ruEND
3080Sigor@sysoev.ru
3090Sigor@sysoev.ru
3101825Sthresh@nginx.com# unitd man page
3111825Sthresh@nginx.com
3121825Sthresh@nginx.comcat << END >> $NXT_MAKEFILE
3131825Sthresh@nginx.com
3141825Sthresh@nginx.com$NXT_BUILD_DIR/unitd.8: docs/man/unitd.8.in $NXT_BUILD_DIR/nxt_auto_config.h
3151825Sthresh@nginx.com	sed -e "s|%%ERROR_LOG_PATH%%|$NXT_LOG|" \\
3161825Sthresh@nginx.com		-e "s|%%PID_PATH%%|$NXT_PID|" \\
3171825Sthresh@nginx.com		-e "s|%%SOCKET_PATH%%|$NXT_CONTROL|" \\
3181825Sthresh@nginx.com		< docs/man/unitd.8.in > \$@
3191825Sthresh@nginx.com
3201825Sthresh@nginx.comEND
3211825Sthresh@nginx.com
3221825Sthresh@nginx.com
323259Sigor@sysoev.ru# unit object files.
3240Sigor@sysoev.ru
3250Sigor@sysoev.rufor nxt_src in $NXT_MAKE_SRCS
3260Sigor@sysoev.rudo
327396Smax.romanov@nginx.com    nxt_obj=${nxt_src%.c}.o
328396Smax.romanov@nginx.com    nxt_dep=${nxt_src%.c}.dep
329396Smax.romanov@nginx.com    nxt_dep_flags=`nxt_gen_dep_flags`
330396Smax.romanov@nginx.com    nxt_dep_post=`nxt_gen_dep_post`
3310Sigor@sysoev.ru    cat << END >> $NXT_MAKEFILE
3320Sigor@sysoev.ru
3331217Smax.romanov@nginx.com$NXT_BUILD_DIR/$nxt_obj:	$nxt_src $NXT_VERSION_H
3340Sigor@sysoev.ru	\$(CC) -c \$(CFLAGS) \$(NXT_INCS) \\
3350Sigor@sysoev.ru		$NXT_LIB_AUX_CFLAGS \\
3360Sigor@sysoev.ru		-o $NXT_BUILD_DIR/$nxt_obj \\
337396Smax.romanov@nginx.com		$nxt_dep_flags \\
3380Sigor@sysoev.ru		$nxt_src
339396Smax.romanov@nginx.com	$nxt_dep_post
340396Smax.romanov@nginx.com
341396Smax.romanov@nginx.com-include $NXT_BUILD_DIR/$nxt_dep
342396Smax.romanov@nginx.com
3430Sigor@sysoev.ruEND
3440Sigor@sysoev.ru
3450Sigor@sysoev.rudone
3460Sigor@sysoev.ru
3470Sigor@sysoev.ru
348265Smax.romanov@nginx.com# install
349265Smax.romanov@nginx.com
350265Smax.romanov@nginx.comcat << END >> $NXT_MAKEFILE
351265Smax.romanov@nginx.com
3521825Sthresh@nginx.com.PHONY: install ${NXT_DAEMON}-install install-check manpage-install
353265Smax.romanov@nginx.com
3541825Sthresh@nginx.cominstall: ${NXT_DAEMON}-install manpage-install
355265Smax.romanov@nginx.com
356706Sigor@sysoev.ruinstall-check:
357706Sigor@sysoev.ru	@test -n "\$(DESTDIR)$NXT_PREFIX" \\
358706Sigor@sysoev.ru	|| (echo; \\
359706Sigor@sysoev.ru	    echo "error: to make install you need either"; \\
360706Sigor@sysoev.ru	    echo "    to configure --prefix option"; \\
361706Sigor@sysoev.ru	    echo "    or to set DESTDIR environment variable."; \\
362706Sigor@sysoev.ru	    echo; \\
363706Sigor@sysoev.ru	    exit 1)
364706Sigor@sysoev.ru
365706Sigor@sysoev.ru${NXT_DAEMON}-install: $NXT_DAEMON install-check
366265Smax.romanov@nginx.com	install -d \$(DESTDIR)$NXT_SBINDIR
367265Smax.romanov@nginx.com	install -p $NXT_BUILD_DIR/$NXT_DAEMON \$(DESTDIR)$NXT_SBINDIR/
368331Sigor@sysoev.ru	install -d \$(DESTDIR)$NXT_STATE
369265Smax.romanov@nginx.com
3701825Sthresh@nginx.commanpage-install: manpage install-check
3711825Sthresh@nginx.com	install -d \$(DESTDIR)$NXT_MANDIR/man8
3721840Sdefan@nginx.com	install -p -m644 $NXT_BUILD_DIR/unitd.8 \$(DESTDIR)$NXT_MANDIR/man8/
373265Smax.romanov@nginx.com
3741825Sthresh@nginx.com.PHONY: uninstall ${NXT_DAEMON}-uninstall manpage-uninstall
375265Smax.romanov@nginx.com
3761825Sthresh@nginx.comuninstall: ${NXT_DAEMON}-uninstall manpage-uninstall
377265Smax.romanov@nginx.com
378265Smax.romanov@nginx.com${NXT_DAEMON}-uninstall:
379265Smax.romanov@nginx.com	rm -f \$(DESTDIR)$NXT_SBINDIR/$NXT_DAEMON
380265Smax.romanov@nginx.com	@rmdir -p \$(DESTDIR)$NXT_SBINDIR 2>/dev/null || true
381265Smax.romanov@nginx.com
3821825Sthresh@nginx.commanpage-uninstall:
3831825Sthresh@nginx.com	rm -f \$(DESTDIR)$NXT_MANDIR/man8/unitd.8
3841825Sthresh@nginx.com	@rmdir -p \$(DESTDIR)$NXT_MANDIR/man8 2>/dev/null || true
3851825Sthresh@nginx.com
386265Smax.romanov@nginx.comEND
387265Smax.romanov@nginx.com
388805Smax.romanov@nginx.comcat << END >> $NXT_MAKEFILE
389805Smax.romanov@nginx.com
390805Smax.romanov@nginx.com.PHONY: libunit-install libunit-uninstall
391805Smax.romanov@nginx.com
392805Smax.romanov@nginx.comlibunit-install: $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC
393805Smax.romanov@nginx.com	install -d \$(DESTDIR)$NXT_LIBDIR
394805Smax.romanov@nginx.com	install -p -m u=rw,go=r $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \
395805Smax.romanov@nginx.com		\$(DESTDIR)$NXT_LIBDIR/
396805Smax.romanov@nginx.com	install -d \$(DESTDIR)$NXT_INCDIR
3971141Smax.romanov@nginx.com	install -p -m u=rw,go=r src/nxt_unit.h \
3981141Smax.romanov@nginx.com		src/nxt_unit_field.h \
3991141Smax.romanov@nginx.com		src/nxt_unit_request.h \
4001141Smax.romanov@nginx.com		src/nxt_unit_response.h \
4011141Smax.romanov@nginx.com		src/nxt_unit_sptr.h \
4021141Smax.romanov@nginx.com		src/nxt_unit_typedefs.h \
4031141Smax.romanov@nginx.com		src/nxt_unit_websocket.h \
4041710Smax.romanov@nginx.com		$NXT_BUILD_DIR/nxt_auto_config.h \
4051141Smax.romanov@nginx.com		$NXT_BUILD_DIR/nxt_version.h \
4061141Smax.romanov@nginx.com		src/nxt_websocket_header.h \
407877Salexander.borisov@nginx.com		\$(DESTDIR)$NXT_INCDIR/
408805Smax.romanov@nginx.com
409805Smax.romanov@nginx.comlibunit-uninstall:
410805Smax.romanov@nginx.com	rm -f \$(DESTDIR)$NXT_LIBDIR/$NXT_LIB_UNIT_STATIC
411805Smax.romanov@nginx.com	@rmdir -p \$(DESTDIR)$NXT_LIBDIR 2>/dev/null || true
412805Smax.romanov@nginx.com	rm -f \$(DESTDIR)$NXT_INCDIR/nxt_unit.h \
413805Smax.romanov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_unit_field.h \
414805Smax.romanov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_unit_request.h \
415805Smax.romanov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_unit_response.h \
416805Smax.romanov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_unit_sptr.h \
417877Salexander.borisov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_unit_typedefs.h \
4181141Smax.romanov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_unit_websocket.h \
4191710Smax.romanov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_auto_config.h \
4201141Smax.romanov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_version.h \
4211141Smax.romanov@nginx.com		\$(DESTDIR)$NXT_INCDIR/nxt_websocket_header.h
422805Smax.romanov@nginx.com	@rmdir -p \$(DESTDIR)$NXT_INCDIR 2>/dev/null || true
423805Smax.romanov@nginx.com
424805Smax.romanov@nginx.comEND
425805Smax.romanov@nginx.com
4260Sigor@sysoev.ru# Makefile.
4270Sigor@sysoev.ru# *.dSYM is MacOSX Clang debug information.
4280Sigor@sysoev.ru
4290Sigor@sysoev.rucat << END > Makefile
4300Sigor@sysoev.ru
431191Smax.romanov@nginx.cominclude $NXT_MAKEFILE
4320Sigor@sysoev.ru
433304Smax.romanov@nginx.com.PHONY: clean
4340Sigor@sysoev.ruclean:
435216Sigor@sysoev.ru		rm -rf $NXT_BUILD_DIR *.dSYM Makefile
4360Sigor@sysoev.ru
4370Sigor@sysoev.ruEND
438