Skip to content

Commit

Permalink
Enhance make file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Anhuth committed Apr 19, 2018
1 parent f969941 commit 9c8fec7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,6 +6,7 @@ aur/

# Prerequisites
*.d
*.dep

# Compiled Object files
*.slo
Expand Down
36 changes: 24 additions & 12 deletions Makefile
@@ -1,21 +1,33 @@
.PHONY: all clean
SOURCES = main.cpp winctl.cpp
TARGET = winctl

CXXFLAGS = -std=c++14 -Wall -O3
CXXFLAGS += $(shell pkg-config --cflags libwnck-3.0)
CXXFLAGS += $(shell pkg-config --cflags gdk-3.0)
CXXFLAGS += $(shell pkg-config --cflags lua)
CXXFLAGS += $(shell pkg-config --cflags x11)
CXXFLAGS += ${shell pkg-config --cflags libwnck-3.0}
CXXFLAGS += ${shell pkg-config --cflags gdk-3.0}
CXXFLAGS += ${shell pkg-config --cflags lua}
CXXFLAGS += ${shell pkg-config --cflags x11}

LDFLAGS =
LDFLAGS += $(shell pkg-config --libs libwnck-3.0)
LDFLAGS += $(shell pkg-config --libs gdk-3.0)
LDFLAGS += $(shell pkg-config --libs lua)
LDFLAGS += $(shell pkg-config --libs x11)
LDFLAGS += ${shell pkg-config --libs libwnck-3.0}
LDFLAGS += ${shell pkg-config --libs gdk-3.0}
LDFLAGS += ${shell pkg-config --libs lua}
LDFLAGS += ${shell pkg-config --libs x11}

OBJS = ${patsubst %.cpp,%.o,${SOURCES}}
DEPS = ${patsubst %.cpp,%.o.dep,${SOURCES}}

${TARGET}: ${OBJS}
${CXX} -o $@ ${OBJS} ${LDFLAGS}

winctl: arg_parse.h lua.h winctl.h winctl.cpp main.cpp
${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ main.cpp winctl.cpp
.cpp.o: $(SOURCES)
${CXX} ${CXXFLAGS} -c $< -o $@
@${CXX} ${CXXFLAGS} -MP -MT $@ -MF $@.dep -MM $<

-include $(DEPS)

.PHONY: all clean

all: winctl

clean:
-rm winctl
-rm -f ${TARGET} *.o *.o.dep

0 comments on commit 9c8fec7

Please sign in to comment.