summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2015-11-23 22:12:00 +0100
committerQuentin Rameau <quinq@fifth.space>2018-10-08 11:38:03 +0200
commit1bd6d201020f67160872c28534edff532b5198b9 (patch)
tree35f8ed07cf1f50d89cab6dbbf38190135ceabf97 /Makefile
parent0bd553a078cc8ec1d197fd7af96b07b1921049e2 (diff)
downloadsurf-1bd6d201020f67160872c28534edff532b5198b9.tar.gz
surf-1bd6d201020f67160872c28534edff532b5198b9.tar.bz2
surf-1bd6d201020f67160872c28534edff532b5198b9.zip
ext: first commit for surf lib
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 43 insertions, 11 deletions
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