diff options
author | Mattias Andrée <maandree@kth.se> | 2022-02-19 21:34:29 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-02-19 21:34:29 +0100 |
commit | 313f261584bdbdf769d26bfb4d709ac2ff9bb2ba (patch) | |
tree | 8e185f479f427c03c2c119bed307937a131b15b8 /Makefile | |
parent | Improve make file, fix tests, fix warnings, and add macro and pause key to interative test (diff) | |
download | libterminput-313f261584bdbdf769d26bfb4d709ac2ff9bb2ba.tar.gz libterminput-313f261584bdbdf769d26bfb4d709ac2ff9bb2ba.tar.bz2 libterminput-313f261584bdbdf769d26bfb4d709ac2ff9bb2ba.tar.xz |
Improve makefile1.0.2.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | Makefile | 46 |
1 files changed, 24 insertions, 22 deletions
@@ -1,10 +1,5 @@ .POSIX: -LIB_MAJOR = 1 -LIB_MINOR = 0 -LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) - - CONFIGFILE = config.mk include $(CONFIGFILE) @@ -15,22 +10,28 @@ OS = linux include mk/$(OS).mk +LIB_MAJOR = 1 +LIB_MINOR = 0 +LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) -LOBJ =\ - libterminput.lo + +OBJ =\ + libterminput.o HDR =\ libterminput.h -OBJ =\ - interactive-test.o\ - test.o\ - $(LOBJ:.lo=.o) +TESTS =\ + interactive-test\ + test + +LOBJ = $(OBJ:.o=.lo) -all: libterminput.a libterminput.$(LIBEXT) interactive-test test +all: libterminput.a libterminput.$(LIBEXT) $(TESTS) $(OBJ): $(HDR) $(LOBJ): $(HDR) +$(TESTS:=.o): $(HDR) .c.o: $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) @@ -38,20 +39,20 @@ $(LOBJ): $(HDR) .c.lo: $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS) -.o.a: - -rm -f -- $@ - $(AR) rc $@ $< - $(AR) -s $@ - -.lo.$(LIBEXT): - $(CC) $(LIBFLAGS) -o $@ $< $(LDFLAGS) - interactive-test: interactive-test.o libterminput.a $(CC) -o $@ interactive-test.o libterminput.a $(LDFLAGS) test: test.o libterminput.a $(CC) -o $@ test.o libterminput.a $(LDFLAGS) +libterminput.$(LIBEXT): $(LOBJ) + $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) + +libterminput.a: $(OBJ) + -rm -f -- $@ + $(AR) rc $@ $(OBJ) + $(AR) -s $@ + check: test ./test @@ -63,6 +64,7 @@ install: libterminput.a libterminput.$(LIBEXT) cp -- libterminput.a "$(DESTDIR)$(PREFIX)/lib/" cp -- libterminput.h "$(DESTDIR)$(PREFIX)/include/" cp -- libterminput.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libterminput.$(LIBMINOREXT)" + $(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libterminput.$(LIBMINOREXT)" ln -sf -- libterminput.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libterminput.$(LIBMAJOREXT)" ln -sf -- libterminput.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libterminput.$(LIBEXT)" cp -- libterminput_read.3 libterminput_set_flags.3 libterminput_is_ready.3 "$(DESTDIR)$(MANPREFIX)/man3" @@ -82,9 +84,9 @@ uninstall: -rm -f -- "$(DESTDIR)$(MANPREFIX)/man7/libterminput.7" clean: - -rm -f -- *.o *.a *.lo *.so *.su *.dll *.dylib interactive-test test + -rm -f -- *.o *.a *.lo *.so *.so.* *.su *.dll *.dylib interactive-test test .SUFFIXES: -.SUFFIXES: .a .o .lo .c .$(LIBEXT) +.SUFFIXES: .lo .o .c .PHONY: all check install uninstall clean |