CPPFLAGS += -DDEBUG
-CPPFLAGS += -DHAVE_LIBPNG -I/usr/X11/include/
CFLAGS = -g -Wall -Wextra -pedantic -std=c99
-LDFLAGS += -lreadline
-LDFLAGS += -L/usr/X11/lib -lpng
UNAME := $(shell uname)
ifeq ($(UNAME),Darwin)
CPPFLAGS += -DHAVE_FUNOPEN
+# libpng from system x11, libvncserver from macports
+CPPFLAGS += -I/usr/X11/include -I/opt/local/include
+LDFLAGS += -L/usr/X11/lib -L/opt/local/lib
endif
ifeq ($(UNAME),Linux)
# linux needs _GNU_SOURCE for fopencookie
CPPFLAGS += -DHAVE_FOPENCOOKIE -D_GNU_SOURCE
endif
-CPPFLAGS += -DHAVE_LIBVNCSERVER -I/opt/local/include
-LDFLAGS += -L/opt/local/lib -lvncserver
+CPPFLAGS += -DHAVE_LIBVNCSERVER -DHAVE_LIBPNG
+LDFLAGS += -lvncserver -lpng -lreadline
all: $(PROGRAMS)