targets=libPanel,panel,panelctl,run
cflags=-W -Wall -g -O2 -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags=-Wl,-z,relro -Wl,-z,now
dist=Makefile,helper.c,panel.h,window.h

#modes
[mode::embedded-debug]
cppflags_force=-DEMBEDDED

[mode::embedded-release]
cppflags_force=-DEMBEDDED -DNDEBUG
cflags=-W -Wall -O2 -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector

[mode::release]
cppflags_force=-DNDEBUG
cflags=-W -Wall -O2 -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector

#targets
[libPanel]
type=library
sources=panel.c,window.c
cppflags=-D PREFIX=\"$(PREFIX)\"
cflags=`pkg-config --cflags libDesktop` -fPIC
ldflags=`pkg-config --libs libDesktop` -lintl
install=$(LIBDIR)

[panel]
type=binary
depends=$(OBJDIR)libPanel$(SOEXT)
sources=main.c
cppflags=-D PREFIX=\"$(PREFIX)\"
#XXX should not enforce PIE here (for panelctl(1) either)
cflags=`pkg-config --cflags libDesktop` -fPIE
ldflags=`pkg-config --libs libDesktop` -lintl -L$(OBJDIR). -Wl,-rpath,$(LIBDIR) -lPanel -pie
install=$(BINDIR)

[run]
type=binary
sources=run.c
cppflags=-D PREFIX=\"$(PREFIX)\"
cflags=`pkg-config --cflags libDesktop` -fPIE
ldflags=`pkg-config --libs libDesktop` -lintl -pie
install=$(BINDIR)

#sources
[main.c]
depends=../include/Panel.h,panel.h,../config.h

[panel.c]
depends=panel.h,window.h,../include/Panel.h,helper.c,../config.h

[window.c]
depends=../include/Panel.h,panel.h,window.h,../config.h

[panelctl]
type=binary
sources=panelctl.c
cflags=`pkg-config --cflags libDesktop` -fPIE
ldflags=`pkg-config --libs libDesktop` -lintl -pie
install=$(BINDIR)

[panelctl.c]
depends=../include/Panel.h,panel.h,../config.h
