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 From 7ea0c2f7f8c5cc4616d8dc0676f7b4b59351667b Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 7 Dec 2015 15:50:00 +0100 Subject: Communicate with webextension via a pipe --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e1e7e1f..9aace4f 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ options: @$(LIBTOOL) --mode compile --tag CC $(CC) $(LIBCFLAGS) -c $< $(OBJ): config.h config.mk -$(LIBOBJ): config.mk +$(LIBOBJ): config.h config.mk config.h: @echo creating $@ from config.def.h -- cgit v1.2.3 From 1901359efa10fe2e18794df34fc33b81da03a6f5 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 4 Jan 2016 16:09:12 +0100 Subject: Add a file for shared functions New common.[hc] files where shared functions between surf and webkitextension will be put. First addition is die(). --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9aace4f..0385a50 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ include config.mk -SRC = surf.c +SRC = surf.c common.c OBJ = $(SRC:.c=.o) -LIBSRC = libsurf-webext.c +LIBSRC = libsurf-webext.c common.c LIBOBJ = $(LIBSRC:.c=.lo) all: options libsurf-webext.la surf @@ -38,7 +38,7 @@ config.h: libsurf-webext.la: $(LIBOBJ) @echo libtool link $@ @$(LIBTOOL) --mode link --tag CC $(CC) $(LIBLDFLAGS) -o $@ \ - $(LIBOBJ) -rpath $(DESTDIR)$(LIBPREFIX) + $(LIBOBJ) $(LIB) -rpath $(DESTDIR)$(LIBPREFIX) surf: $(OBJ) @echo CC -o $@ -- cgit v1.2.3 From e7c629b258653a5237ca72cf2087a391e55829f1 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 8 Oct 2018 12:34:47 +0200 Subject: Unobfuscate Makefile --- Makefile | 65 +++++++++++++++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 40 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0385a50..72df488 100644 --- a/Makefile +++ b/Makefile @@ -21,78 +21,63 @@ options: @echo "LIBTOOL = $(LIBTOOL)" .c.o: - @echo CC -c $< - @$(CC) $(SURFCFLAGS) -c $< + $(CC) $(SURFCFLAGS) -c $< .c.lo: - @echo libtool compile $< - @$(LIBTOOL) --mode compile --tag CC $(CC) $(LIBCFLAGS) -c $< + $(LIBTOOL) --mode compile --tag CC $(CC) $(LIBCFLAGS) -c $< $(OBJ): config.h config.mk $(LIBOBJ): config.h config.mk config.h: - @echo creating $@ from config.def.h - @cp config.def.h $@ + cp config.def.h $@ libsurf-webext.la: $(LIBOBJ) - @echo libtool link $@ - @$(LIBTOOL) --mode link --tag CC $(CC) $(LIBLDFLAGS) -o $@ \ + $(LIBTOOL) --mode link --tag CC $(CC) $(LIBLDFLAGS) -o $@ \ $(LIBOBJ) $(LIB) -rpath $(DESTDIR)$(LIBPREFIX) surf: $(OBJ) - @echo CC -o $@ - @$(CC) $(SURFCFLAGS) -o $@ $(OBJ) $(SURFLDFLAGS) + $(CC) $(SURFCFLAGS) -o $@ $(OBJ) $(SURFLDFLAGS) clean-lib: - @echo cleaning library - @rm -rf libsurf-webext.la .libs $(LIBOBJ) $(LIBOBJ:.lo=.o) + rm -rf libsurf-webext.la .libs $(LIBOBJ) $(LIBOBJ:.lo=.o) clean: clean-lib - @echo cleaning - @rm -f surf $(OBJ) + rm -f surf $(OBJ) distclean: clean - @echo cleaning dist - @rm -f config.h surf-$(VERSION).tar.gz + rm -f config.h surf-$(VERSION).tar.gz dist: distclean - @echo creating dist tarball - @mkdir -p surf-$(VERSION) - @cp -R LICENSE Makefile config.mk config.def.h README \ + 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) $(LIBSRC) surf-$(VERSION) - @tar -cf surf-$(VERSION).tar surf-$(VERSION) - @gzip surf-$(VERSION).tar - @rm -rf surf-$(VERSION) + tar -cf surf-$(VERSION).tar surf-$(VERSION) + gzip surf-$(VERSION).tar + rm -rf surf-$(VERSION) install-lib: libsurf-webext.la - @echo installing library file to $(DESTDIR)$(LIBPREFIX) - @mkdir -p $(DESTDIR)$(LIBPREFIX) - @$(LIBTOOL) --mode install install -c libsurf-webext.la \ + 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 - @chmod 755 $(DESTDIR)$(PREFIX)/bin/surf - @echo installing manual page to $(DESTDIR)$(MANPREFIX)/man1 - @mkdir -p $(DESTDIR)$(MANPREFIX)/man1 - @sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1 - @chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1 + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f surf $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/surf + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1 uninstall-lib: - @echo removing library file from $(DESTDIR)$(LIBPREFIX) - @$(LIBTOOL) --mode uninstall rm -f \ + $(LIBTOOL) --mode uninstall rm -f \ $(DESTDIR)$(LIBPREFIX)/libsurf-webext.la - @- rm -df $(DESTDIR)$(LIBPREFIX) + - 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 + rm -f $(DESTDIR)$(PREFIX)/bin/surf + rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1 .SUFFIXES: .la .lo .o .c .PHONY: all options clean-dist clean dist install-lib install uninstall-lib uninstall -- cgit v1.2.3 From 3321c42d36ce79ebecd8b2ea7e93ca2e5c2ff98d Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 8 Oct 2018 13:47:25 +0200 Subject: Remove libtool depencency, reorganise Makefile We don't need libtool anymore, just build the library directly. This lets us simplify the Makefile too. --- Makefile | 65 +++++++++++++++++++++++++++------------------------------------- 1 file changed, 27 insertions(+), 38 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 72df488..3b601ff 100644 --- a/Makefile +++ b/Makefile @@ -6,44 +6,38 @@ include config.mk SRC = surf.c common.c OBJ = $(SRC:.c=.o) -LIBSRC = libsurf-webext.c common.c -LIBOBJ = $(LIBSRC:.c=.lo) +WEBEXTSRC = libsurf-webext.c +WEBEXTOBJ = $(WEBEXTSRC:.c=.o) -all: options libsurf-webext.la surf +all: options libsurf-webext.so surf options: @echo surf build options: - @echo "CFLAGS = $(SURFCFLAGS)" - @echo "LDFLAGS = $(SURFLDFLAGS)" - @echo "CC = $(CC)" - @echo "LIBCFLAGS = $(LIBCFLAGS)" - @echo "LIBLDFLAGS = $(LIBLDFLAGS)" - @echo "LIBTOOL = $(LIBTOOL)" + @echo "CC = $(CC)" + @echo "CFLAGS = $(SURFCFLAGS) $(CFLAGS)" + @echo "WEBEXTCFLAGS = $(WEBEXTCFLAGS) $(CFLAGS)" + @echo "LDFLAGS = $(LDFLAGS)" .c.o: - $(CC) $(SURFCFLAGS) -c $< + $(CC) $(SURFCFLAGS) $(CFLAGS) -c $< -.c.lo: - $(LIBTOOL) --mode compile --tag CC $(CC) $(LIBCFLAGS) -c $< +config.h: + cp config.def.h $@ $(OBJ): config.h config.mk -$(LIBOBJ): config.h config.mk -config.h: - cp config.def.h $@ +$(WEBEXTOBJ): config.h config.mk + $(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WEBEXTSRC) -libsurf-webext.la: $(LIBOBJ) - $(LIBTOOL) --mode link --tag CC $(CC) $(LIBLDFLAGS) -o $@ \ - $(LIBOBJ) $(LIB) -rpath $(DESTDIR)$(LIBPREFIX) +libsurf-webext.so: $(WEBEXTOBJ) + $(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $< $(WEBEXTLIBS) -lc surf: $(OBJ) - $(CC) $(SURFCFLAGS) -o $@ $(OBJ) $(SURFLDFLAGS) + $(CC) $(SURFLDLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) -clean-lib: - rm -rf libsurf-webext.la .libs $(LIBOBJ) $(LIBOBJ:.lo=.o) - -clean: clean-lib +clean: rm -f surf $(OBJ) + rm -f libsurf-webext.so $(WEBEXTOBJ) distclean: clean rm -f config.h surf-$(VERSION).tar.gz @@ -52,32 +46,27 @@ 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) $(LIBSRC) surf-$(VERSION) + surf.1 $(SRC) $(WEBEXTSRC) surf-$(VERSION) tar -cf surf-$(VERSION).tar surf-$(VERSION) gzip surf-$(VERSION).tar rm -rf surf-$(VERSION) -install-lib: libsurf-webext.la - mkdir -p $(DESTDIR)$(LIBPREFIX) - $(LIBTOOL) --mode install install -c libsurf-webext.la \ - $(DESTDIR)$(LIBPREFIX)/libsurf-webext.la - -install: all install-lib +install: all mkdir -p $(DESTDIR)$(PREFIX)/bin cp -f surf $(DESTDIR)$(PREFIX)/bin chmod 755 $(DESTDIR)$(PREFIX)/bin/surf + mkdir -p $(DESTDIR)$(WEBEXTDIR) + cp -f libsurf-webext.so $(DESTDIR)$(WEBEXTDIR) + chmod 644 $(DESTDIR)$(PREFIX)/bin/surf mkdir -p $(DESTDIR)$(MANPREFIX)/man1 sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1 -uninstall-lib: - $(LIBTOOL) --mode uninstall rm -f \ - $(DESTDIR)$(LIBPREFIX)/libsurf-webext.la - - rm -df $(DESTDIR)$(LIBPREFIX) - -uninstall: uninstall-lib +uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/surf rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1 + rm -f $(DESTDIR)$(WEBEXTDIR)/libsurf-webext.so + - rmdir $(DESTDIR)$(WEBEXTDIR) -.SUFFIXES: .la .lo .o .c -.PHONY: all options clean-dist clean dist install-lib install uninstall-lib uninstall +.SUFFIXES: .so .o .c +.PHONY: all options clean-dist clean dist install uninstall -- cgit v1.2.3 From 47e39851ca12749d24c66f948054c42289756ca7 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 8 Oct 2018 14:11:24 +0200 Subject: Fix webext directory in Makefile --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3b601ff..6a4906e 100644 --- a/Makefile +++ b/Makefile @@ -55,9 +55,9 @@ install: all mkdir -p $(DESTDIR)$(PREFIX)/bin cp -f surf $(DESTDIR)$(PREFIX)/bin chmod 755 $(DESTDIR)$(PREFIX)/bin/surf - mkdir -p $(DESTDIR)$(WEBEXTDIR) - cp -f libsurf-webext.so $(DESTDIR)$(WEBEXTDIR) - chmod 644 $(DESTDIR)$(PREFIX)/bin/surf + mkdir -p $(DESTDIR)$(LIBDIR) + cp -f libsurf-webext.so $(DESTDIR)$(LIBDIR) + chmod 644 $(DESTDIR)$(LIBDIR)/bin/libsurf-webext.so mkdir -p $(DESTDIR)$(MANPREFIX)/man1 sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1 @@ -65,8 +65,8 @@ install: all uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/surf rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1 - rm -f $(DESTDIR)$(WEBEXTDIR)/libsurf-webext.so - - rmdir $(DESTDIR)$(WEBEXTDIR) + rm -f $(DESTDIR)$(LIBDIR)/libsurf-webext.so + - rmdir $(DESTDIR)$(LIBDIR) .SUFFIXES: .so .o .c .PHONY: all options clean-dist clean dist install uninstall -- cgit v1.2.3 From 4e7371317c7cb4ed3c4c6bd9b66b45c37018f52f Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 8 Oct 2018 14:23:51 +0200 Subject: Fix, again, webext directory in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6a4906e..10505f3 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ install: all chmod 755 $(DESTDIR)$(PREFIX)/bin/surf mkdir -p $(DESTDIR)$(LIBDIR) cp -f libsurf-webext.so $(DESTDIR)$(LIBDIR) - chmod 644 $(DESTDIR)$(LIBDIR)/bin/libsurf-webext.so + chmod 644 $(DESTDIR)$(LIBDIR)/libsurf-webext.so mkdir -p $(DESTDIR)$(MANPREFIX)/man1 sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1 -- cgit v1.2.3 From 16beb6f8acd5e589be11168ab6c1944c4411052e Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Tue, 9 Oct 2018 12:26:32 +0200 Subject: Makefile: fix dependencies --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 10505f3..cdbd8ad 100644 --- a/Makefile +++ b/Makefile @@ -24,9 +24,9 @@ options: config.h: cp config.def.h $@ -$(OBJ): config.h config.mk +$(OBJ): config.h common.h config.mk -$(WEBEXTOBJ): config.h config.mk +$(WEBEXTOBJ): $(WEBEXTSRC) config.h common.h config.mk $(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WEBEXTSRC) libsurf-webext.so: $(WEBEXTOBJ) -- cgit v1.2.3