Makefile improvements.

* Respect CXX, CXXFLAGS and LDFLAGS.
 * Add an install rule.
This commit is contained in:
Karl Linden 2017-10-08 14:06:57 +02:00
parent c5e17d2436
commit 497342a11a
No known key found for this signature in database
GPG Key ID: 8C756B6564F8BB64
1 changed files with 11 additions and 4 deletions

View File

@ -1,17 +1,24 @@
CXXFLAGS ?= -O2
PREFIX ?= /usr/local
all: xkblayout-state all: xkblayout-state
XKeyboard.o: XKeyboard.cpp XKeyboard.h X11Exception.h XKeyboard.o: XKeyboard.cpp XKeyboard.h X11Exception.h
g++ -c -Wall -O2 XKeyboard.cpp -o XKeyboard.o $(CXX) $(CXXFLAGS) -Wall -c -o $@ $<
wrapper.o: wrapper.cpp XKeyboard.h wrapper.o: wrapper.cpp XKeyboard.h
g++ -c -Wall -O2 wrapper.cpp -o wrapper.o $(CXX) $(CXXFLAGS) -Wall -c -o $@ $<
xkblayout-state: XKeyboard.o wrapper.o xkblayout-state: XKeyboard.o wrapper.o
g++ XKeyboard.o wrapper.o -lX11 -o xkblayout-state $(CXX) $(CXXFLAGS) $(LDFLAGS) -lX11 -o xkblayout-state $^
clean: clean:
rm -f xkblayout-state XKeyboard.o wrapper.o rm -f xkblayout-state XKeyboard.o wrapper.o
install: xkblayout-state
install xkblayout-state $(DESTDIR)$(PREFIX)/bin
dist: dist:
tar cfa xkblayout-state-v1b.tar.gz Makefile README.md wrapper.cpp X11Exception.h XKeyboard.cpp XKeyboard.h tar cfa xkblayout-state-v1b.tar.gz Makefile README.md wrapper.cpp X11Exception.h XKeyboard.cpp XKeyboard.h