Makefile
changeset 18 2e991b769c95
parent 15 a261abd34f1b
child 20 9cf206648ce7
equal deleted inserted replaced
17:e11e0adb941b 18:2e991b769c95
    10 host_os = linux
    10 host_os = linux
    11 ifneq '' '$(COMSPEC)'
    11 ifneq '' '$(COMSPEC)'
    12   host_os = windows
    12   host_os = windows
    13 endif
    13 endif
    14 
    14 
    15 ALL_DIR = all
    15 ITEMS = .Xdefaults .bashrc .mailsign .xinitrc .mc
    16 LINUX_DIR = linux
       
    17 WIN_DIR = win
       
    18 
       
    19 ifeq 'linux' '$(host_os)'
       
    20   DIRS = all linux
       
    21 endif
       
    22 ifeq 'windows' '$(host_os)'
       
    23   DIRS = all
       
    24   # DIRS += win
       
    25 endif
       
    26 
    16 
    27 .PHONY: install
    17 .PHONY: install
    28 install:
    18 install:
    29 	for srcdir in $(DIRS); do \
    19 	for item in $(ITEMS); do \
    30 		prefix=$$PWD/$$srcdir; \
    20 		[ -f $$item ] && install -m 640 $$item $(HOME)/$$item; \
    31 		for item in `find $$prefix -type f`; do \
    21 		[ -d $$item ] && for file in `find $$item`; do \
    32 			fname=$${item##*/}; \
    22 			[ -d $$file ] && [ -d $(HOME)/$$item ] || mkdir -p $(HOME)/$$item; \
    33 			file=$${item#$${prefix}/}; \
    23 			[ -f $$file ] && install -m 640 $$item $(HOME)/$$item; \
    34 			dir=$${file%$${fname}}; \
       
    35 			dir=$${dir%/}; \
       
    36 			[ -n $$dir ] && mkdir -p $(HOME)/$$dir; \
       
    37 			install -m 660 $$srcdir/$$file $(HOME)/$$dir; \
       
    38 		done; \
    24 		done; \
    39 	done
    25 	done
    40 
    26 
    41 .PHONY: uninstall
    27 .PHONY: uninstall
    42 uninstall:
    28 uninstall:
    45 .PHONY: clean
    31 .PHONY: clean
    46 clean:
    32 clean:
    47 
    33 
    48 .PHONY: distclean
    34 .PHONY: distclean
    49 distclean: clean
    35 distclean: clean
    50