Makefile

changeset 0
86b7f6f9c5c0
child 1
6e704fc09528
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Tue Feb 15 18:57:52 2005 +0100
@@ -0,0 +1,75 @@
+#
+# libtu Makefile
+#
+
+# Where to install? ($PREFIX/lib/libtu.a, $PREFIX/include/libtu/)
+#
+PREFIX=/usr/local
+
+# Any extra defines needed
+#
+#DEFINES=
+
+# Any extra include paths needed
+#
+#INCLUDES=
+
+######################################
+
+WARN=	-W -Wimplicit -Wreturn-type -Wswitch -Wcomment \
+	-Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized \
+	-Wparentheses -pedantic-errors
+
+CC_FLAGS=-g -O2 -ansi $(DEFINES) $(INCLUDES) $(WARN)
+CC=gcc
+AR=ar
+AR_FLAGS=crs
+
+INSTALL=install
+MODE=644
+
+######################################
+
+OBJS= misc.o output.o util.o optparser.o parser.o tokenizer.o
+	
+DEPEND= .depend
+
+LIBDIR=$(PREFIX)/lib
+INCDIR=$(PREFIX)/include/libtu
+
+TARGETS=libtu.a
+TESTERS=tester tester2 tester3
+
+######################################
+
+all: $(TARGETS)
+
+testers: $(TESTERS)
+
+libtu.a: $(OBJS)
+	$(AR) $(AR_FLAGS) $@ $+
+
+%: %.c
+	$(CC) $(CC_FLAGS) $+ -L. -ltu -lm -o $@
+
+%.o: %.c
+	$(CC) $(CC_FLAGS) -c $< -o $@
+
+clean:
+	rm -f $(OBJS) $(DEPEND)
+
+realclean: clean
+	rm -f $(TARGETS)
+
+depend:
+	$(CC) -M $(CC_FLAGS) *.c > $(DEPEND)
+
+install:
+	$(INSTALL) -d $(LIBDIR)
+	$(INSTALL) -d $(INCDIR)
+	$(INSTALL) -m $(MODE) libtu.a $(LIBDIR)
+	$(INSTALL) -m $(MODE) include/* $(INCDIR)
+
+ifeq ($(DEPEND),$(wildcard $(DEPEND)))
+include $(DEPEND)
+endif

mercurial