about summary refs log tree commit diff stats
path: root/linux
diff options
context:
space:
mode:
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