about summary refs log tree commit diff stats
path: root/linux
diff options
context:
space:
mode:
authorDave Collins <davec@conformal.com>2011-11-03 12:11:40 -0500
committerDave Collins <davec@conformal.com>2011-11-03 12:13:17 -0500
commit44c460ee551e06e89a7c3043ce1bd4ea32ed73c8 (patch)
tree0ecd09536cc1ea9ac446b6c29e3b0ee1a59708a8 /linux
parentfa4cb1d518bfb3123e7bd7e6011a2879ae07924c (diff)
downloadxombrero-44c460ee551e06e89a7c3043ce1bd4ea32ed73c8.tar.gz
Add automatic dependency generation for linux.
Also improve the makefile to use dynamic sources and objects.
Diffstat (limited to 'linux')
-rw-r--r--linux/Makefile20
1 files changed, 16 insertions, 4 deletions
diff --git a/linux/Makefile b/linux/Makefile
index 03fad43..2a74391 100644
--- a/linux/Makefile
+++ b/linux/Makefile
@@ -8,6 +8,11 @@ BINDIR?= $(PREFIX)/bin
 LIBDIR?= $(PREFIX)/lib
 MANDIR?= $(PREFIX)/share/man
 
+SRCS= $(shell ls ../*.c)
+SRCS+= linux.c
+OBJS= $(SRCS:.c=.o)
+DEPS= $(addsuffix .depend, $(OBJS))
+
 CC?= gcc
 
 all: javascript.h xxxterm
@@ -16,11 +21,15 @@ javascript.h: ../js-merge-helper.pl ../hinting.js
 	perl ../js-merge-helper.pl ../hinting.js ../input-focus.js > \
 	javascript.h
 
-xxxterm.o: javascript.h
-
-xxxterm: ../whitelist.o ../cookie.o ../settings.o ../marco.o ../about.o ../inspector.o ../xxxterm.o linux.o
+xxxterm: $(OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LDADD)
 
+%.o: %.c
+	@echo "Generating $@.depend"
+	@$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< | \
+	sed 's,^.*\.o[ :]*,$@ $@.depend : ,g' > $@.depend
+	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+
 install: all
 	install -m 755 -d $(DESTDIR)$(BINDIR)
 	install -m 755 -d $(DESTDIR)$(LIBDIR)
@@ -29,7 +38,10 @@ install: all
 	install -m 644 ../xxxterm.1 $(DESTDIR)$(MANDIR)/man1/xxxterm.1
 
 clean:
-	rm -f xxxterm *.o ../*.o
+	rm -f xxxterm $(OBJS) $(DEPS)
 	rm -f javascript.h
 
+
+-include $(DEPS)
+
 .PHONY: all install clean