1 ROOT_DIR
:= $(shell dirname
$(realpath
$(lastword
$(MAKEFILE_LIST
))))
4 LIBSLIRP
= $(BUILD_DIR
)/libslirp.a
8 SRCS
:= $(wildcard src
/*.c
)
9 OBJS
:= $(SRCS
:%.c
=$(BUILD_DIR
)/%.o
)
10 DEPS
:= $(OBJS
:%.o
=%.d
)
12 INC_DIRS
:= $(BUILD_DIR
)/src
13 INC_FLAGS
:= $(addprefix -I
,$(INC_DIRS
))
16 -DG_LOG_DOMAIN
='"Slirp"' \
17 $(shell $(PKG_CONFIG
) --cflags glib-2.0
) \
20 override LDFLAGS
+= $(shell $(PKG_CONFIG
) --libs glib-2.0
)
27 rm -r
$(OBJS
) $(DEPS
) $(LIBSLIRP
)
29 $(BUILD_DIR
)/src
/%.o
: $(ROOT_DIR
)/src
/%.c
31 $(call quiet-command
,$(CC
) $(CFLAGS
) -c
-o
$@
$<,"CC","$@")
34 $(call quiet-command
,rm -f
$@
&& $(AR
) rcs
$@
$^
,"AR","$@")
36 PKG_CONFIG ?
= pkg-config
38 quiet-command-run
= $(if
$(V
),,$(if
$2,printf
" %-7s %s\n" $2 $3 && ))$1
39 quiet-@
= $(if
$(V
),,@
)
40 quiet-command
= $(quiet-@
)$(call quiet-command-run
,$1,$2,$3)