From 1bd6d201020f67160872c28534edff532b5198b9 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 23 Nov 2015 22:12:00 +0100 Subject: ext: first commit for surf lib --- Makefile | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d32d330..e1e7e1f 100644 --- a/Makefile +++ b/Makefile @@ -6,30 +6,49 @@ include config.mk SRC = surf.c OBJ = $(SRC:.c=.o) +LIBSRC = libsurf-webext.c +LIBOBJ = $(LIBSRC:.c=.lo) -all: options surf +all: options libsurf-webext.la surf options: @echo surf build options: - @echo "CFLAGS = $(SURF_CFLAGS)" - @echo "LDFLAGS = $(SURF_LDFLAGS)" - @echo "CC = $(CC)" + @echo "CFLAGS = $(SURFCFLAGS)" + @echo "LDFLAGS = $(SURFLDFLAGS)" + @echo "CC = $(CC)" + @echo "LIBCFLAGS = $(LIBCFLAGS)" + @echo "LIBLDFLAGS = $(LIBLDFLAGS)" + @echo "LIBTOOL = $(LIBTOOL)" .c.o: @echo CC -c $< - @$(CC) $(SURF_CFLAGS) -c $< + @$(CC) $(SURFCFLAGS) -c $< + +.c.lo: + @echo libtool compile $< + @$(LIBTOOL) --mode compile --tag CC $(CC) $(LIBCFLAGS) -c $< $(OBJ): config.h config.mk +$(LIBOBJ): config.mk config.h: @echo creating $@ from config.def.h @cp config.def.h $@ +libsurf-webext.la: $(LIBOBJ) + @echo libtool link $@ + @$(LIBTOOL) --mode link --tag CC $(CC) $(LIBLDFLAGS) -o $@ \ + $(LIBOBJ) -rpath $(DESTDIR)$(LIBPREFIX) + surf: $(OBJ) @echo CC -o $@ - @$(CC) $(SURF_CFLAGS) -o $@ $(OBJ) $(SURF_LDFLAGS) + @$(CC) $(SURFCFLAGS) -o $@ $(OBJ) $(SURFLDFLAGS) + +clean-lib: + @echo cleaning library + @rm -rf libsurf-webext.la .libs $(LIBOBJ) $(LIBOBJ:.lo=.o) -clean: +clean: clean-lib @echo cleaning @rm -f surf $(OBJ) @@ -42,12 +61,18 @@ dist: distclean @mkdir -p surf-$(VERSION) @cp -R LICENSE Makefile config.mk config.def.h README \ surf-open.sh arg.h TODO.md surf.png \ - surf.1 $(SRC) surf-$(VERSION) + surf.1 $(SRC) $(LIBSRC) surf-$(VERSION) @tar -cf surf-$(VERSION).tar surf-$(VERSION) @gzip surf-$(VERSION).tar @rm -rf surf-$(VERSION) -install: all +install-lib: libsurf-webext.la + @echo installing library file to $(DESTDIR)$(LIBPREFIX) + @mkdir -p $(DESTDIR)$(LIBPREFIX) + @$(LIBTOOL) --mode install install -c libsurf-webext.la \ + $(DESTDIR)$(LIBPREFIX)/libsurf-webext.la + +install: all install-lib @echo installing executable file to $(DESTDIR)$(PREFIX)/bin @mkdir -p $(DESTDIR)$(PREFIX)/bin @cp -f surf $(DESTDIR)$(PREFIX)/bin @@ -57,10 +82,17 @@ install: all @sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1 @chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1 -uninstall: +uninstall-lib: + @echo removing library file from $(DESTDIR)$(LIBPREFIX) + @$(LIBTOOL) --mode uninstall rm -f \ + $(DESTDIR)$(LIBPREFIX)/libsurf-webext.la + @- rm -df $(DESTDIR)$(LIBPREFIX) + +uninstall: uninstall-lib @echo removing executable file from $(DESTDIR)$(PREFIX)/bin @rm -f $(DESTDIR)$(PREFIX)/bin/surf @echo removing manual page from $(DESTDIR)$(MANPREFIX)/man1 @rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1 -.PHONY: all options clean dist install uninstall +.SUFFIXES: .la .lo .o .c +.PHONY: all options clean-dist clean dist install-lib install uninstall-lib uninstall -- cgit v1.2.3