surf

surf browser, a WebKit2GTK based browser
Log | Files | Refs | README | LICENSE

Makefile (2732B)


      1 # surf - simple browser
      2 # See LICENSE file for copyright and license details.
      3 .POSIX:
      4 
      5 include config.mk
      6 
      7 SRC = surf.c common.c
      8 OBJ = $(SRC:.c=.o)
      9 LIBSRC = libsurf-webext.c common.c
     10 LIBOBJ = $(LIBSRC:.c=.lo)
     11 
     12 all: options libsurf-webext.la surf
     13 
     14 options:
     15 	@echo surf build options:
     16 	@echo "CFLAGS    = $(SURF_CFLAGS)"
     17 	@echo "LDFLAGS   = $(SURF_LDFLAGS)"
     18 	@echo "CC        = $(CC)"
     19 	@echo "LIBCFLAGS  = $(LIBCFLAGS)"
     20 	@echo "LIBLDFLAGS = $(LIBLDFLAGS)"
     21 	@echo "LIBTOOL    = $(LIBTOOL)"
     22 
     23 .SUFFIXES: .la .lo .o .c
     24 
     25 .c.o:
     26 	@echo CC -c $<
     27 	@$(CC) $(SURF_CFLAGS) -c $<
     28 
     29 .c.lo:
     30 	@echo libtool compile $<
     31 	@$(LIBTOOL) --mode compile --tag CC $(CC) $(LIBCFLAGS) -c $<
     32 
     33 $(OBJ): config.h config.mk
     34 $(LIBOBJ): config.h config.mk
     35 
     36 config.h:
     37 	@echo creating $@ from config.def.h
     38 	@cp config.def.h $@
     39 
     40 libsurf-webext.la: $(LIBOBJ)
     41 	@echo libtool link $@
     42 	@$(LIBTOOL) --mode link --tag CC $(CC) $(LIB) $(LIBLDFLAGS) -o $@ \
     43 	    $(LIBOBJ) -rpath $(DESTDIR)$(LIBPREFIX)
     44 
     45 surf: $(OBJ)
     46 	@echo CC -o $@
     47 	@$(CC) $(SURF_CFLAGS) -o $@ $(OBJ) $(SURF_LDFLAGS)
     48 
     49 clean-lib:
     50 	@echo cleaning library
     51 	@rm -rf libsurf-webext.la .libs $(LIBOBJ) $(LIBOBJ:.lo=.o)
     52 
     53 clean: clean-lib
     54 	@echo cleaning
     55 	@rm -f surf $(OBJ)
     56 
     57 distclean: clean
     58 	@echo cleaning dist
     59 	@rm -f config.h surf-$(VERSION).tar.gz
     60 
     61 dist: distclean
     62 	@echo creating dist tarball
     63 	@mkdir -p surf-$(VERSION)
     64 	@cp -R LICENSE Makefile config.mk config.def.h README \
     65 	    surf-open.sh arg.h TODO.md surf.png \
     66 	    surf.1 $(SRC) surf-$(VERSION)
     67 	@tar -cf surf-$(VERSION).tar surf-$(VERSION)
     68 	@gzip surf-$(VERSION).tar
     69 	@rm -rf surf-$(VERSION)
     70 
     71 install-lib: libsurf-webext.la
     72 	@echo installing library file to $(DESTDIR)$(LIBPREFIX)
     73 	@mkdir -p $(DESTDIR)$(LIBPREFIX)
     74 	@$(LIBTOOL) --mode install install -c libsurf-webext.la \
     75 		$(DESTDIR)$(LIBPREFIX)/libsurf-webext.la
     76 
     77 install: all install-lib
     78 	@echo installing executable file to $(DESTDIR)$(PREFIX)/bin
     79 	@mkdir -p $(DESTDIR)$(PREFIX)/bin
     80 	@cp -f surf $(DESTDIR)$(PREFIX)/bin
     81 	@chmod 755 $(DESTDIR)$(PREFIX)/bin/surf
     82 	@echo installing manual page to $(DESTDIR)$(MANPREFIX)/man1
     83 	@mkdir -p $(DESTDIR)$(MANPREFIX)/man1
     84 	@sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1
     85 	@chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1
     86 
     87 uninstall-lib:
     88 	@echo removing library file from $(DESTDIR)$(LIBPREFIX)
     89 	@$(LIBTOOL) --mode uninstall rm -f \
     90 	    $(DESTDIR)$(LIBPREFIX)/libsurf-webext.la
     91 	@rm -df $(DESTDIR)$(LIBPREFIX) || true
     92 
     93 uninstall: uninstall-lib
     94 	@echo removing executable file from $(DESTDIR)$(PREFIX)/bin
     95 	@rm -f $(DESTDIR)$(PREFIX)/bin/surf
     96 	@echo removing manual page from $(DESTDIR)$(MANPREFIX)/man1
     97 	@rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1
     98 
     99 .PHONY: all options clean-dist clean dist install-lib install uninstall-lib uninstall