surf

My custom build of surf web browser.
git clone https://git.mtkn.jp/surf
Log | Files | Refs | README | LICENSE

Makefile (2035B)


      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
      8 WSRC = webext-surf.c
      9 OBJ = $(SRC:.c=.o)
     10 WOBJ = $(WSRC:.c=.o)
     11 WLIB = $(WSRC:.c=.so)
     12 CONFSRC = $(PWD)/config
     13 
     14 all: options surf $(WLIB)
     15 
     16 options:
     17 	@echo surf build options:
     18 	@echo "CC            = $(CC)"
     19 	@echo "CFLAGS        = $(SURFCFLAGS) $(CFLAGS)"
     20 	@echo "WEBEXTCFLAGS  = $(WEBEXTCFLAGS) $(CFLAGS)"
     21 	@echo "LDFLAGS       = $(LDFLAGS)"
     22 
     23 surf: $(OBJ)
     24 	$(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
     25 
     26 $(OBJ) $(WOBJ): config.h common.h config.mk
     27 
     28 config.h:
     29 	cp config.def.h $@
     30 
     31 $(OBJ): $(SRC)
     32 	$(CC) $(SURFCFLAGS) $(CFLAGS) -c $(SRC)
     33 
     34 $(WLIB): $(WOBJ)
     35 	$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $? $(WEBEXTLIBS)
     36 
     37 $(WOBJ): $(WSRC)
     38 	$(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WSRC)
     39 
     40 clean:
     41 	rm -f surf $(OBJ)
     42 	rm -f $(WLIB) $(WOBJ)
     43 
     44 distclean: clean
     45 	rm -f config.h surf-$(VERSION).tar.gz
     46 
     47 dist: distclean
     48 	mkdir -p surf-$(VERSION)
     49 	cp -R LICENSE Makefile config.mk config.def.h README \
     50 	    surf-open.sh arg.h TODO.md surf.png \
     51 	    surf.1 common.h $(SRC) $(WSRC) surf-$(VERSION)
     52 	tar -cf surf-$(VERSION).tar surf-$(VERSION)
     53 	gzip surf-$(VERSION).tar
     54 	rm -rf surf-$(VERSION)
     55 
     56 install: all
     57 	mkdir -p $(DESTDIR)$(PREFIX)/bin
     58 	cp -f surf $(DESTDIR)$(PREFIX)/bin
     59 	chmod 755 $(DESTDIR)$(PREFIX)/bin/surf
     60 	mkdir -p $(DESTDIR)$(LIBDIR)
     61 	cp -f $(WLIB) $(DESTDIR)$(LIBDIR)
     62 	for wlib in $(WLIB); do \
     63 	    chmod 644 $(DESTDIR)$(LIBDIR)/$$wlib; \
     64 	done
     65 	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
     66 	sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1
     67 	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1
     68 	if [ -n "$(XDG_CONFIG_HOME)" ]; then \
     69 		ln -s $(CONFSRC) $(CONFDST); \
     70 	fi
     71 
     72 uninstall:
     73 	rm -f $(DESTDIR)$(PREFIX)/bin/surf
     74 	rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1
     75 	for wlib in $(WLIB); do \
     76 	    rm -f $(DESTDIR)$(LIBDIR)/$$wlib; \
     77 	done
     78 	- rmdir $(DESTDIR)$(LIBDIR)
     79 	if [ -n "$(XDG_CONFIG_HOME)" -a -h $(CONFDST) ]; then \
     80 		rm $(CONFDST); \
     81 	fi
     82 
     83 .PHONY: all options distclean clean dist install uninstall