surf

Mahdi's build of surf
git clone git://mahdi.pw/surf.git
Log | Files | Refs | README | LICENSE

Makefile (2140B)


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