Index: dmd_gtk-1.2.0/Makefile
===================================================================
--- dmd_gtk-1.2.0.orig/Makefile
+++ dmd_gtk-1.2.0/Makefile
@@ -1,13 +1,16 @@
 SRCDIR = src
 LIBDIR = lib
 CC = gcc
-CFLAGS = $(shell pkg-config --cflags gtk+-3.0) -Wall -std=gnu99
+CFLAGS = $(shell printenv CFLAGS)
+CFLAGS += $(shell pkg-config --cflags gtk+-3.0) $(shell pkg-config --cflags libtelnet) -Wall -std=gnu99
 GTKLIBS = $(shell pkg-config --libs gtk+-3.0)
+TELNETLIBS = $(shell pkg-config --libs libtelnet)
 EXE = dmd5620
-CSRC = $(wildcard src/*.c)
+CSRC = src/dmd_5620.c
 OBJ = $(CSRC:.c=.o)
-LDFLAGS = $(GTKLIBS) -lm -lpthread -lc -ldl
-CORELIB = $(LIBDIR)/libdmd_core.a
+LDFLAGS = $(shell printenv LDFLAGS)
+LDFLAGS += $(GTKLIBS) $(TELNETLIBS) -lm -lpthread -lc -ldl
+CORELIB = $(shell pkg-config --libs dmd_core)
 
 ifeq ($(PREFIX),)
 PREFIX := /usr/local
@@ -16,7 +19,7 @@ endif
 ifdef DEBUG
 CFLAGS+ = -g -O0
 else
-CFLAGS += -O3 -Os -s
+CFLAGS += -O3 -Os
 endif
 
 .PHONY: all clean
