summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorThorsten Wißmann <edu@thorsten-wissmann.de>2012-06-16 22:59:18 +0200
committerThorsten Wißmann <edu@thorsten-wissmann.de>2012-06-16 23:07:56 +0200
commitc6a37e3b50519a419231a5e18a69fd643c218ab0 (patch)
tree4a8bd75b3ce34c92f52d59a01b30867594897325 /Makefile
parent35aaf2496dcc3d2dc9ee7a2b777eeb08c6e9f4ec (diff)
One Makefile for herbstluftwm and herbstclient
This merges the two Makefiles for herbstluftwm and herbstclient (in the ipc-client/ subdirectory) into one large Makefile. This also fixes the build error for massive parallel build processes and moves the herbstclient target from ipc-client/ to the main directory.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile62
1 files changed, 42 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 472e46b9..d2fe3310 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,49 @@
include version.mk
include config.mk
+include colors.mk
+
+HEADER = $(wildcard src/*.h) $(wildcard ipc-client/*.h)
+
+HLWMSRC = $(wildcard src/*.c)
+HLWMOBJ = $(HLWMSRC:.c=.o)
+HLWMTARGET = herbstluftwm
+
+HCSRC = $(wildcard ipc-client/*.c) src/utils.c
+HCOBJ = $(HCSRC:.c=.o)
+HCTARGET = herbstclient
+
+TARGETS = $(HLWMTARGET) $(HCTARGET)
+OBJ = $(HLWMOBJ) $(HCOBJ)
-# project
-SRCDIR = src
-SRC = $(wildcard $(SRCDIR)/*.c)
-HEADER = $(wildcard $(SRCDIR)/*.h)
-OBJ = ${SRC:.c=.o}
-TARGET = herbstluftwm
HERBSTCLIENTDOC = doc/herbstclient.txt
HERBSTLUFTWMDOC = doc/herbstluftwm.txt
-include colors.mk
-include rules.mk
+.PHONY: all all-nodoc doc cleandoc install info www cleanwww clean
-all: build-herbstclient doc
-clean: clean-herbstclient cleandoc
+all: $(TARGETS) doc
+all-nodoc: $(TARGETS)
+$(HLWMTARGET): $(HLWMOBJ)
+$(HCTARGET): $(HCOBJ)
-.PHONY: doc cleandoc install www cleanwww
+$(TARGETS):
+ $(call colorecho,LD,$@)
+ $(VERBOSE) $(LD) -o $@ $(LDFLAGS) $^ $(LIBS)
+
+%.o: %.c $(HEADER)
+ $(call colorecho,CC,$<)
+ $(VERBOSE) $(CC) -c $(CFLAGS) -o $@ $<
+
+info:
+ @echo Some Info:
+ @echo Compiling with: $(CC) -c $(CFLAGS) -o OUT INPUT
+ @echo Linking with: $(LD) -o OUT $(LDFLAGS) INPUT
+
+clean: cleandoc
+ $(call colorecho,RM,$(TARGETS))
+ $(VERBOSE) rm -f $(TARGETS)
+ $(call colorecho,RM,$(OBJ))
+ $(VERBOSE) rm -f $(OBJ)
cleandoc:
$(call colorecho,RM,doc/herbstclient.1)
@@ -29,13 +55,10 @@ cleandoc:
$(call colorecho,RM,doc/herbstluftwm.html)
$(VERBOSE) rm -f doc/herbstluftwm.html
-build-herbstclient:
- $(MAKE) -C ipc-client
-
-clean-herbstclient:
- $(MAKE) -C ipc-client clean
-
-doc: doc/herbstclient.1 doc/herbstclient.html doc/herbstluftwm.1 doc/herbstluftwm.html
+doc: doc/herbstclient.1 \
+ doc/herbstclient.html \
+ doc/herbstluftwm.1 \
+ doc/herbstluftwm.html
tar: doc
tar -czf $(TARFILE) `git ls-files` doc/*.html doc/*.[0-9]
@@ -66,8 +89,7 @@ install: all
$(MKDIR) '$(DESTDIR)/$(ZSHCOMPLETIONDIR)'
$(MKDIR) '$(DESTDIR)/$(XSESSIONSDIR)'
@echo "==> copying files..."
- $(INSTALL) $(TARGET) '$(DESTDIR)/$(BINDIR)'
- $(INSTALL) ipc-client/herbstclient '$(DESTDIR)/$(BINDIR)/'
+ $(INSTALL) $(TARGETS) '$(DESTDIR)/$(BINDIR)'
$(INSTALL) -m 644 LICENSE '$(DESTDIR)/$(LICENSEDIR)'
$(INSTALL) -m 644 doc/herbstclient.1 '$(DESTDIR)/$(MAN1DIR)/'
$(INSTALL) -m 644 doc/herbstluftwm.1 '$(DESTDIR)/$(MAN1DIR)/'