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)
|
||||
endif
|
||||
|
||||
CFLAGS += -I.
|
||||
LDFLAGS += -L.
|
||||
LIBS := $(shell pkg-config --libs ${pkg_config_packs})
|
||||
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'))
|
||||
OBJ := ${SRC:.c=.o}
|
||||
|
33
config.mk
33
config.mk
@ -2,23 +2,24 @@
|
||||
PREFIX ?= /usr/local
|
||||
MANPREFIX = ${PREFIX}/share/man
|
||||
|
||||
# Warning: This is deprecated behavior
|
||||
# uncomment to disable parsing of dunstrc
|
||||
# or use "CFLAGS=-DSTATIC_CONFIG make" to build
|
||||
#STATIC= -DSTATIC_CONFIG
|
||||
|
||||
PKG_CONFIG:=$(shell which pkg-config)
|
||||
ifeq (${PKG_CONFIG}, ${EMPTY})
|
||||
$(error "Failed to find pkg-config, please make sure it is installed")
|
||||
endif
|
||||
#STATIC= -DSTATIC_CONFIG # Warning: This is deprecated behavior
|
||||
|
||||
# flags
|
||||
CPPFLAGS += -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
|
||||
CFLAGS += -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC} ${CPPFLAGS}
|
||||
LDFLAGS += -lm -L${X11LIB}
|
||||
|
||||
pkg_config_packs := dbus-1 x11 xscrnsaver \
|
||||
"glib-2.0 >= 2.36" gio-2.0 \
|
||||
pangocairo gdk-3.0 xrandr xinerama
|
||||
pkg_config_packs := dbus-1 \
|
||||
gio-2.0 \
|
||||
gdk-3.0 \
|
||||
"glib-2.0 >= 2.36" \
|
||||
pangocairo \
|
||||
x11 \
|
||||
xinerama \
|
||||
xrandr \
|
||||
xscrnsaver
|
||||
|
||||
# check if we need libxdg-basedir
|
||||
ifeq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
||||
@ -31,15 +32,3 @@ endif
|
||||
ifneq (,$(findstring dunstify,${MAKECMDGOALS}))
|
||||
pkg_config_packs += libnotify
|
||||
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