summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile94
1 files changed, 47 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index 45274aa..af17f07 100644
--- a/Makefile
+++ b/Makefile
@@ -4,72 +4,72 @@
include config.mk
-SRC = surf.c
+SRC = surf.c common.c
OBJ = $(SRC:.c=.o)
+WEBEXTSRC = libsurf-webext.c
+WEBEXTOBJ = $(WEBEXTSRC:.c=.o)
-all: options surf
+all: options libsurf-webext.so surf
options:
@echo surf build options:
- @echo "CFLAGS = $(SURF_CFLAGS)"
- @echo "LDFLAGS = $(SURF_LDFLAGS)"
- @echo "CC = $(CC)"
+ @echo "CC = $(CC)"
+ @echo "CFLAGS = $(SURFCFLAGS) $(CFLAGS)"
+ @echo "WEBEXTCFLAGS = $(WEBEXTCFLAGS) $(CFLAGS)"
+ @echo "LDFLAGS = $(LDFLAGS)"
.c.o:
- @echo CC -c $<
- @$(CC) $(SURF_CFLAGS) -c $<
-
-$(OBJ): config.h config.mk
+ $(CC) $(SURFCFLAGS) $(CFLAGS) -c $<
config.h:
- @echo creating $@ from config.def.h
- @cp config.def.h $@
+ cp config.def.h $@
+
+$(OBJ): config.h common.h config.mk
+
+$(WEBEXTOBJ): $(WEBEXTSRC) config.h common.h config.mk
+ $(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WEBEXTSRC)
+
+libsurf-webext.so: $(WEBEXTOBJ)
+ $(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $< $(WEBEXTLIBS) -lc
surf: $(OBJ)
- @echo CC -o $@
- @$(CC) $(SURF_CFLAGS) -o $@ $(OBJ) $(SURF_LDFLAGS)
+ $(CC) $(SURFLDLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
clean:
- @echo cleaning
- @rm -f surf $(OBJ)
+ rm -f surf $(OBJ)
+ rm -f libsurf-webext.so $(WEBEXTOBJ)
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) surf-$(VERSION)
- @tar -cf surf-$(VERSION).tar surf-$(VERSION)
- @gzip surf-$(VERSION).tar
- @rm -rf surf-$(VERSION)
+ surf.1 $(SRC) $(WEBEXTSRC) surf-$(VERSION)
+ tar -cf surf-$(VERSION).tar surf-$(VERSION)
+ gzip surf-$(VERSION).tar
+ rm -rf surf-$(VERSION)
install: all
- @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 surf-menu to $(DESTDIR)$(PREFIX)/bin
- @cp -f surf-menu $(DESTDIR)$(PREFIX)/bin
- @chmod 755 $(DESTDIR)$(PREFIX)/bin/surf-menu
- @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
- @echo installing desktop file to $(DESTDIR)/usr/share/applications
- @mkdir -p $(DESTDIR)/usr/share/applications
- @cp -f surf.desktop $(DESTDIR)/usr/share/applications/surf.desktop
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ cp -f surf $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/surf
+ cp -f surf-menu $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/surf-menu
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ cp -f libsurf-webext.so $(DESTDIR)$(LIBDIR)
+ 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
uninstall:
- @echo removing executable file from $(DESTDIR)$(PREFIX)/bin
- @rm -f $(DESTDIR)$(PREFIX)/bin/surf
- @rm -f $(DESTDIR)$(PREFIX)/bin/surf-menu
- @echo removing manual page from $(DESTDIR)$(MANPREFIX)/man1
- @rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1
- @echo removing desktop page from $(DESTDIR)/usr/share/applications
- @rm -f $(DESTDIR)/usr/share/applications/surf.desktop
-
-.PHONY: all options clean dist install uninstall
+ rm -f $(DESTDIR)$(PREFIX)/bin/surf
+ rm -f $(DESTDIR)$(PREFIX)/bin/surf-menu
+ rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1
+ rm -f $(DESTDIR)$(LIBDIR)/libsurf-webext.so
+ - rmdir $(DESTDIR)$(LIBDIR)
+
+.SUFFIXES: .so .o .c
+.PHONY: all options clean-dist clean dist install uninstall