+FOUND_PKGS = 0
+
ifneq ($(PKGS),)
- ifeq ($(shell $(PKG_CONFIG) --exists --print-errors $(PKGS) && echo ok),)
- $(error PKGS not found)
+ ifeq ($(shell $(PKG_CONFIG) --exists --print-errors $(PKGS) 2>/dev/null && echo ok),)
+ else
+ FOUND_PKGS = 1
endif
+ifeq ($(FOUND_PKGS),1)
+
CPPFLAGS += $(shell $(PKG_CONFIG) --cflags-only-I $(PKGS))
CFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other $(PKGS))
LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-other $(PKGS))
LIBS += $(shell $(PKG_CONFIG) --libs-only-L $(PKGS)) \
$(shell $(PKG_CONFIG) --libs-only-l $(PKGS))
+endif
+
+endif
+pkg-check:
+ifeq ($(FOUND_PKGS),0)
+ $(error $(shell $(PKG_CONFIG) --exists --print-errors $(PKGS)))
endif
$(if $(NAME),,$(error NAME not specified for target))
$(if $(SOURCES),,$(error SOURCES not specified for target))
-# FIXME: hack, should check for the "install" target and not include
-# it then instead of by the name
-ifeq ($(NAME),jscorebus)
-include build/pkgconfig.mk
-endif
CONFIGFLAGS := $(if $(CONFIG),-include $(CONFIG),)
GENERICFLAGS := $(CPPFLAGS) $(CONFIGFLAGS) $(CFLAGS) -c -MD
-include $(SOURCES:%=$(O)/obj/%.d)
-$(OBJECTS) $(PIC_OBJECTS): $(CONFIG)
+$(OBJECTS) $(PIC_OBJECTS): pkg-check $(CONFIG)