aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-09-16 18:10:26 +0200
committerMattias Andrée <maandree@kth.se>2021-09-16 18:10:26 +0200
commit76c910e166d2b1887c5d355df4efec47ec0ce3bd (patch)
treeb5761449486d6cadf6d4e00bd96a92fb5d7890cc /Makefile
parentMerge branch 'rewrite' (diff)
downloadlibhaiku-76c910e166d2b1887c5d355df4efec47ec0ce3bd.tar.gz
libhaiku-76c910e166d2b1887c5d355df4efec47ec0ce3bd.tar.bz2
libhaiku-76c910e166d2b1887c5d355df4efec47ec0ce3bd.tar.xz
Improve makefile, fix warnings, and fix libhaiku_perror linking2.0.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 19 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index b22a6af..3ee1e78 100644
--- a/Makefile
+++ b/Makefile
@@ -16,21 +16,28 @@ LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
MAN3 = libhaiku.7
MAN7 = libhaiku_generic.3 libhaiku_perror.3 libhaiku_perror2.3 libhaiku_strerror.3
+OBJ = libhaiku.o
+HDR = libhaiku.h
+
+LOBJ = $(OBJ:.o=.lo)
+
all: libhaiku.a libhaiku.$(LIBEXT)
+$(OBJ): $(HDR)
+$(LOBJ): $(HDR)
-libhaiku.o: libhaiku.c libhaiku.h
- $(CC) -c -o $@ libhaiku.c $(CFLAGS) $(CPPFLAGS)
+.c.o:
+ $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
-libhaiku.lo: libhaiku.c libhaiku.h
- $(CC) -fPIC -c -o $@ libhaiku.c $(CFLAGS) $(CPPFLAGS)
+.c.lo:
+ $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
-libhaiku.$(LIBEXT): libhaiku.lo
- $(CC) $(LIBFLAGS) -o $@ libhaiku.lo $(LDFLAGS)
+libhaiku.$(LIBEXT): $(LOBJ)
+ $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)
-libhaiku.a: libhaiku.o
+libhaiku.a: $(OBJ)
-rm -f -- $@
- $(AR) rc $@ libhaiku.o
+ $(AR) rc $@ $(OBJ)
$(AR) -s $@
install: libhaiku.$(LIBEXT) libhaiku.a
@@ -56,6 +63,9 @@ uninstall:
-cd -- "$(DESTDIR)$(MANPREFIX)/man7/" && rm -rf -- $(MAN7)
clean:
- -rm -f -- *.o *.lo *.a *.su *.$(LIBEXT) *.$(LIBEXT).* *.*.$(LIBEXT)
+ -rm -f -- *.o *.lo *.a *.su *.$(LIBEXT) *.$(LIBEXT).*
+
+.SUFFIXES:
+.SUFFIXES: .lo .o .c
.PHONY: all install uninstall clean