Reorganise CLFAGS/LDFLAGS handling
This commit is contained in:
parent
1091a976f2
commit
bfc8b17c27
13
Makefile
13
Makefile
@ -8,8 +8,17 @@ ifneq ($(wildcard ./.git/.),)
|
|||||||
VERSION := $(shell git describe --tags)
|
VERSION := $(shell git describe --tags)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -I.
|
LIBS := $(shell pkg-config --libs ${pkg_config_packs})
|
||||||
LDFLAGS += -L.
|
INCS := $(shell pkg-config --cflags ${pkg_config_packs})
|
||||||
|
|
||||||
|
ifneq (clean, $(MAKECMDGOALS))
|
||||||
|
ifeq ($(and $(INCS),$(LIBS)),)
|
||||||
|
$(error "pkg-config failed!")
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS += -I. ${INCS}
|
||||||
|
LDFLAGS+= -L. ${LIBS}
|
||||||
|
|
||||||
SRC := $(sort $(shell find src/ -name '*.c'))
|
SRC := $(sort $(shell find src/ -name '*.c'))
|
||||||
OBJ := ${SRC:.c=.o}
|
OBJ := ${SRC:.c=.o}
|
||||||
|
33
config.mk
33
config.mk
@ -2,23 +2,24 @@
|
|||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
MANPREFIX = ${PREFIX}/share/man
|
MANPREFIX = ${PREFIX}/share/man
|
||||||
|
|
||||||
# Warning: This is deprecated behavior
|
|
||||||
# uncomment to disable parsing of dunstrc
|
# uncomment to disable parsing of dunstrc
|
||||||
# or use "CFLAGS=-DSTATIC_CONFIG make" to build
|
# or use "CFLAGS=-DSTATIC_CONFIG make" to build
|
||||||
#STATIC= -DSTATIC_CONFIG
|
#STATIC= -DSTATIC_CONFIG # Warning: This is deprecated behavior
|
||||||
|
|
||||||
PKG_CONFIG:=$(shell which pkg-config)
|
|
||||||
ifeq (${PKG_CONFIG}, ${EMPTY})
|
|
||||||
$(error "Failed to find pkg-config, please make sure it is installed")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS += -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
|
CPPFLAGS += -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
|
||||||
CFLAGS += -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC} ${CPPFLAGS}
|
CFLAGS += -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC} ${CPPFLAGS}
|
||||||
|
LDFLAGS += -lm -L${X11LIB}
|
||||||
|
|
||||||
pkg_config_packs := dbus-1 x11 xscrnsaver \
|
pkg_config_packs := dbus-1 \
|
||||||
"glib-2.0 >= 2.36" gio-2.0 \
|
gio-2.0 \
|
||||||
pangocairo gdk-3.0 xrandr xinerama
|
gdk-3.0 \
|
||||||
|
"glib-2.0 >= 2.36" \
|
||||||
|
pangocairo \
|
||||||
|
x11 \
|
||||||
|
xinerama \
|
||||||
|
xrandr \
|
||||||
|
xscrnsaver
|
||||||
|
|
||||||
# check if we need libxdg-basedir
|
# check if we need libxdg-basedir
|
||||||
ifeq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
ifeq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
||||||
@ -31,15 +32,3 @@ endif
|
|||||||
ifneq (,$(findstring dunstify,${MAKECMDGOALS}))
|
ifneq (,$(findstring dunstify,${MAKECMDGOALS}))
|
||||||
pkg_config_packs += libnotify
|
pkg_config_packs += libnotify
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# includes and libs
|
|
||||||
INCS := $(shell ${PKG_CONFIG} --cflags ${pkg_config_packs})
|
|
||||||
CFLAGS += ${INCS}
|
|
||||||
LDFLAGS += -lm -L${X11LIB} -lXss $(shell ${PKG_CONFIG} --libs ${pkg_config_packs})
|
|
||||||
|
|
||||||
# only make this an fatal error when where not cleaning
|
|
||||||
ifneq (clean, $(MAKECMDGOALS))
|
|
||||||
ifeq (${INCS}, ${EMPTY})
|
|
||||||
$(error "pkg-config failed, see errors above")
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user