Makefile
changeset 2 48e601bfbca6
parent 0 2acea9e3c0ea
child 12 52322e5cc6bb
equal deleted inserted replaced
1:3e1f409cb848 2:48e601bfbca6
     2 
     2 
     3 ifeq '' '$(HOME)'
     3 ifeq '' '$(HOME)'
     4   $(error HOME env var and prefix var are not set!)
     4   $(error HOME env var and prefix var are not set!)
     5 endif
     5 endif
     6 
     6 
       
     7 host_os = linux
       
     8 ifneq '' '$(WINDRIVE)'         # TODO
       
     9   host_os = windows
       
    10 endif
       
    11 
     7 .PHONY: all install uninstall clean distclean
    12 .PHONY: all install uninstall clean distclean
     8 
    13 
       
    14 ALL_DIR = all
       
    15 LINUX_DIR = linux
       
    16 WIN_DIR = win
       
    17 
       
    18 ifeq 'linux' '$(host_os)'
       
    19   DIRS = all linux
       
    20 endif
       
    21 ifeq 'windows' '$(host_os)'
       
    22   DIRS = all win
       
    23 endif
       
    24 
     9 install:
    25 install:
    10 	install -m 440 .mailsign $(HOME)
    26 	for srcdir in $(DIRS); do \
       
    27 		for item in `cd  $$srcdir; find $$PWD -type f`; do \
       
    28 			file=$${item#$${PWD}/$${srcdir}/}; \
       
    29 			fname=$${item##*/}; \
       
    30 			dir=$${item#$${PWD}/$${srcdir}}; \
       
    31 			dir=$${dir%/$${fname}}; \
       
    32 			dir=$${dir#/}; \
       
    33 			echo mkdir -p $(HOME)/$$dir; \
       
    34 			echo install -m 660 $$srcdir/$$file $(HOME)/$$dir; \
       
    35 		done; \
       
    36 	done
    11 
    37 
    12 uninstall:
    38 uninstall:
    13 	rm -f $(HOME)/.mailsign
    39 	rm -f $(HOME)/.mailsign
    14 
    40 
    15 clean:
    41 clean: