# Copyright (C) 2011,2013 G.P. Halkes
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
.POSIX:

# C-compiler flags
CFLAGS=-O2

# Configuration flags and libraries. Add -DNO_AUTOLEARN if you do not wish to
# compile the auto-learn option which requires XCB or Xlib. Include flags here
# to compile against the libtinfo or (n)curses library
CONFIGFLAGS=
CONFIGLIBS=

# Flags and libraries to compile against XCB or Xlib. To compile against Xlib,
# also add -DUSE_XLIB
X11_FLAGS=
X11_LIBS=

# Installation prefix
prefix=/usr/local

all: src.util/t3learnkeys/t3learnkeys

.PHONY: all clean dist-clean
.SUFFIXES: .c .o
.SECONDARY: # Tell GNU make not to delete intermediate files

SILENTCC=@echo '[CC]' $< ;
SILENTLD=@echo '[LD]' $@ ;

OBJECTS=src.util/t3learnkeys/x11.o src.util/t3learnkeys/t3learnkeys.o

clean:
	rm -rf src.util/t3learnkeys/*.o src.util/t3learnkeys/t3learnkeys

dist-clean: clean

.c.o:
	$(SILENTCC) $(CC) $(CFLAGS) $(CONFIGFLAGS) $(X11_FLAGS) -Isrc.util -c -o $@ $<

src.util/t3learnkeys/t3learnkeys: $(OBJECTS)
	$(SILENTLD) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS) $(CONFIGLIBS) $(X11_LIBS)

