|
| 1 | +# Copyright Joyent, Inc. and other Node contributors. All rights reserved. |
| 2 | +# |
| 3 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | +# of this software and associated documentation files (the "Software"), to |
| 5 | +# deal in the Software without restriction, including without limitation the |
| 6 | +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 7 | +# sell copies of the Software, and to permit persons to whom the Software is |
| 8 | +# furnished to do so, subject to the following conditions: |
| 9 | +# |
| 10 | +# The above copyright notice and this permission notice shall be included in |
| 11 | +# all copies or substantial portions of the Software. |
| 12 | +# |
| 13 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 18 | +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 19 | +# IN THE SOFTWARE. |
| 20 | + |
| 21 | +uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
| 22 | + |
| 23 | +ifdef MSVC |
| 24 | +uname_S := MINGW |
| 25 | +endif |
| 26 | + |
| 27 | +CPPFLAGS += -Iinclude -Iinclude/uv-private |
| 28 | + |
| 29 | +CARES_OBJS = |
| 30 | +CARES_OBJS += src/ares/ares__close_sockets.o |
| 31 | +CARES_OBJS += src/ares/ares__get_hostent.o |
| 32 | +CARES_OBJS += src/ares/ares__read_line.o |
| 33 | +CARES_OBJS += src/ares/ares__timeval.o |
| 34 | +CARES_OBJS += src/ares/ares_cancel.o |
| 35 | +CARES_OBJS += src/ares/ares_data.o |
| 36 | +CARES_OBJS += src/ares/ares_destroy.o |
| 37 | +CARES_OBJS += src/ares/ares_expand_name.o |
| 38 | +CARES_OBJS += src/ares/ares_expand_string.o |
| 39 | +CARES_OBJS += src/ares/ares_fds.o |
| 40 | +CARES_OBJS += src/ares/ares_free_hostent.o |
| 41 | +CARES_OBJS += src/ares/ares_free_string.o |
| 42 | +CARES_OBJS += src/ares/ares_gethostbyaddr.o |
| 43 | +CARES_OBJS += src/ares/ares_gethostbyname.o |
| 44 | +CARES_OBJS += src/ares/ares_getnameinfo.o |
| 45 | +CARES_OBJS += src/ares/ares_getopt.o |
| 46 | +CARES_OBJS += src/ares/ares_getsock.o |
| 47 | +CARES_OBJS += src/ares/ares_init.o |
| 48 | +CARES_OBJS += src/ares/ares_library_init.o |
| 49 | +CARES_OBJS += src/ares/ares_llist.o |
| 50 | +CARES_OBJS += src/ares/ares_mkquery.o |
| 51 | +CARES_OBJS += src/ares/ares_nowarn.o |
| 52 | +CARES_OBJS += src/ares/ares_options.o |
| 53 | +CARES_OBJS += src/ares/ares_parse_a_reply.o |
| 54 | +CARES_OBJS += src/ares/ares_parse_aaaa_reply.o |
| 55 | +CARES_OBJS += src/ares/ares_parse_mx_reply.o |
| 56 | +CARES_OBJS += src/ares/ares_parse_ns_reply.o |
| 57 | +CARES_OBJS += src/ares/ares_parse_ptr_reply.o |
| 58 | +CARES_OBJS += src/ares/ares_parse_srv_reply.o |
| 59 | +CARES_OBJS += src/ares/ares_parse_txt_reply.o |
| 60 | +CARES_OBJS += src/ares/ares_process.o |
| 61 | +CARES_OBJS += src/ares/ares_query.o |
| 62 | +CARES_OBJS += src/ares/ares_search.o |
| 63 | +CARES_OBJS += src/ares/ares_send.o |
| 64 | +CARES_OBJS += src/ares/ares_strcasecmp.o |
| 65 | +CARES_OBJS += src/ares/ares_strdup.o |
| 66 | +CARES_OBJS += src/ares/ares_strerror.o |
| 67 | +CARES_OBJS += src/ares/ares_timeout.o |
| 68 | +CARES_OBJS += src/ares/ares_version.o |
| 69 | +CARES_OBJS += src/ares/ares_writev.o |
| 70 | +CARES_OBJS += src/ares/bitncmp.o |
| 71 | +CARES_OBJS += src/ares/inet_net_pton.o |
| 72 | +CARES_OBJS += src/ares/inet_ntop.o |
| 73 | + |
| 74 | +ifneq (,$(findstring MINGW,$(uname_S))) |
| 75 | +include config-mingw.mk |
| 76 | +else |
| 77 | +include config-unix.mk |
| 78 | +endif |
| 79 | + |
| 80 | +TESTS=test/blackhole-server.c test/echo-server.c test/test-*.c |
| 81 | +BENCHMARKS=test/blackhole-server.c test/echo-server.c test/dns-server.c test/benchmark-*.c |
| 82 | + |
| 83 | +all: uv.a |
| 84 | + |
| 85 | +$(CARES_OBJS): %.o: %.c |
| 86 | + $(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H |
| 87 | + |
| 88 | +test/run-tests$(E): test/*.h test/run-tests.c $(RUNNER_SRC) test/runner-unix.c $(TESTS) uv.a |
| 89 | + $(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o test/run-tests test/run-tests.c \ |
| 90 | + test/runner.c $(RUNNER_SRC) $(TESTS) uv.a $(RUNNER_LIBS) $(RUNNER_LINKFLAGS) |
| 91 | + |
| 92 | +test/run-benchmarks$(E): test/*.h test/run-benchmarks.c test/runner.c $(RUNNER_SRC) $(BENCHMARKS) uv.a |
| 93 | + $(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o test/run-benchmarks test/run-benchmarks.c \ |
| 94 | + test/runner.c $(RUNNER_SRC) $(BENCHMARKS) uv.a $(RUNNER_LIBS) $(RUNNER_LINKFLAGS) |
| 95 | + |
| 96 | +test/echo.o: test/echo.c test/echo.h |
| 97 | + $(CC) $(CPPFLAGS) $(CFLAGS) -c test/echo.c -o test/echo.o |
| 98 | + |
| 99 | + |
| 100 | +.PHONY: clean clean-platform distclean distclean-platform test bench |
| 101 | + |
| 102 | + |
| 103 | +test: test/run-tests$(E) |
| 104 | + test/run-tests |
| 105 | + |
| 106 | +#test-%: test/run-tests$(E) |
| 107 | +# test/run-tests $(@:test-%=%) |
| 108 | + |
| 109 | +bench: test/run-benchmarks$(E) |
| 110 | + test/run-benchmarks |
| 111 | + |
| 112 | +#bench-%: test/run-benchmarks$(E) |
| 113 | +# test/run-benchmarks $(@:bench-%=%) |
| 114 | + |
| 115 | +clean: clean-platform |
| 116 | + $(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E) |
| 117 | + |
| 118 | +distclean: distclean-platform |
| 119 | + $(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E) |
0 commit comments