Merge pull request #7 from lilrc/master

Fix linking with --as-needed.
This commit is contained in:
Kristian Setälä 2017-11-05 11:37:03 +02:00 committed by GitHub
commit b35fb960a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 11 deletions

View File

@ -2,23 +2,25 @@ CXXFLAGS ?= -O2
PREFIX ?= /usr/local
all: xkblayout-state
headers := XKeyboard.h X11Exception.h
sources := XKeyboard.cpp wrapper.cpp
objects := $(sources:.cpp=.o)
program := xkblayout-state
XKeyboard.o: XKeyboard.cpp XKeyboard.h X11Exception.h
all: $(program)
$(objects): %.o: %.cpp $(headers)
$(CXX) $(CXXFLAGS) -Wall -c -o $@ $<
wrapper.o: wrapper.cpp XKeyboard.h
$(CXX) $(CXXFLAGS) -Wall -c -o $@ $<
xkblayout-state: XKeyboard.o wrapper.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -lX11 -o xkblayout-state $^
$(program): $(objects)
$(CXX) $(CXXFLAGS) -lX11 $(LDFLAGS) -o $@ $^
clean:
rm -f xkblayout-state XKeyboard.o wrapper.o
rm -f $(program) $(objects)
install: xkblayout-state
install xkblayout-state $(DESTDIR)$(PREFIX)/bin
install: $(program)
install $(program) $(DESTDIR)$(PREFIX)/bin
dist:
tar cfa xkblayout-state-v1b.tar.gz Makefile README.md wrapper.cpp X11Exception.h XKeyboard.cpp XKeyboard.h
tar cfa $(program)-v1b.tar.gz Makefile README.md $(headers) $(sources)