- 
                Notifications
    You must be signed in to change notification settings 
- Fork 9
Refactor Makefile #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            AitorATuin
  wants to merge
  2
  commits into
  gobolinux:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
AitorATuin:refactor_makefile
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| *.swp | ||
| *~ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,57 +1,108 @@ | ||
|  | ||
| PYTHON_VERSION=2.7 | ||
| PYTHON_LIBS=FindPackage GetAvailable GuessLatest CheckDependencies DescribeProgram UseFlags Corrections | ||
| PYTHON_SITE=lib/python$(PYTHON_VERSION)/site-packages | ||
| PROGRAM=Scripts | ||
| VERSION=git-$(shell date +%Y%m%d) | ||
| goboPrograms?=/Programs | ||
| PREFIX?= | ||
| DESTDIR=$(goboPrograms)/$(PROGRAM)/$(VERSION) | ||
| DESTDIR=$(PREFIX)/$(goboPrograms)/$(PROGRAM)/$(VERSION) | ||
|  | ||
| man_files = $(shell cd bin; grep -l Parse_Options * | xargs -i echo share/man/man1/{}.1) | ||
| exec_files = $(patsubst src/%.c,bin/%,$(wildcard src/*.c)) | ||
| INSTALL_FILE = install | ||
| INSTALL_DIR = install -d | ||
|  | ||
| all: python $(exec_files) manuals | ||
| PYTHON_VERSION=2.7 | ||
| PYTHON_LIBS=FindPackage GetAvailable GuessLatest CheckDependencies DescribeProgram UseFlags Corrections | ||
| PYTHON_SITE=python$(PYTHON_VERSION)/site-packages | ||
|  | ||
| debug: python | ||
| cd src; $(MAKE) debug | ||
| RUBY_VERSION=1.8 | ||
| RUBY_SITE=ruby/site_ruby/$(RUBY_VERSION) | ||
| RUBY_DIR=$(RUBY_SITE)/gobo | ||
|  | ||
| MAN_FILES = $(shell cd bin;grep -l Parse_Options * | xargs -i echo share/man/man1/{}.1) | ||
| EXEC_FILES = $(patsubst src/%.c,%,$(wildcard src/*.c)) | ||
| SCRIPT_FILES = AddUser AttachProgram DeduceName FindPackage GoboPath install PrioritiseUpdates ScriptFunctions UnversionExecutables VersionExecutables Alien AugmentCommandNotFoundDatabase Dependencies FindQuick GrepQuick InstallPackage ProblemReport SignProgram UpdateKdeRecipe which Alien-Cabal CheckDependants DescribeProgram FixAttributes GrepReplace KillProcess RemoveBroken SuggestDuplicates UpdateSettings xmlcatalog Alien-CPAN CheckDependencies DetachProgram FixDirReferences GuessLatest ListProgramFiles RemoveEmpty SuggestUpdates UpdateXorgRecipe Alien-LuaRocks CleanModules DisableProgram FixInfo GuessProgramCase RemoveProgram SymlinkProgram UpgradeSystem Alien-PIP Corrections FilterColors GenBuildInformation HasCompatiblePackage MergeTree Rename SystemFind UseFlags Alien-RubyGems CreatePackage FilterLines GetAvailable Hashes NamingConventions RescueInstallPackage SystemInfo VerifyProgram | ||
|  | ||
| .PHONY: all clean install | ||
|  | ||
| all: python manuals | ||
| @$(MAKE) -C src | ||
| $(foreach EXE_FILE, $(EXEC_FILES), \ | ||
| cp -af src/$(EXE_FILE) bin ; \ | ||
| chmod a+x bin/$(EXE_FILE) ; \ | ||
| ) | ||
|  | ||
| python: | ||
| for f in $(PYTHON_LIBS); \ | ||
| do libf=$(PYTHON_SITE)/$$f.py; \ | ||
| rm -f $$libf; ln -nfs ../../../bin/$$f $$libf; \ | ||
| done | ||
| cd $(PYTHON_SITE) && \ | ||
| mkdir -p lib/$(PYTHON_SITE) | ||
| $(foreach PYTHON_LIB, $(PYTHON_LIBS), \ | ||
| ln -nfs ../../../bin/$(PYTHON_LIB) lib/$(PYTHON_SITE)/$(PYTHON_LIB).py ; \ | ||
| ) | ||
| cp lib/python/*.py lib/$(PYTHON_SITE) | ||
| cd lib/$(PYTHON_SITE) && \ | ||
| for f in *.py; \ | ||
| do python -c "import `basename $$f .py`"; \ | ||
| do python -c "import `basename $$f .py`"; \ | ||
| done | ||
|  | ||
| clean: | ||
| rm -rf Resources/FileHash* | ||
| find * -path "*~" -or -path "*/.\#*" -or -path "*.bak" | xargs rm -f | ||
| cd src && $(MAKE) clean | ||
| cd $(PYTHON_SITE) && rm -f *.pyc *.pyo | ||
| rm -f $(exec_files) | ||
| python_clean: | ||
| rm -rf lib/$(dir $(PYTHON_SITE)) | ||
|  | ||
| clean: python_clean | ||
| @$(MAKE) -C src clean | ||
| @echo "Cleaning man pages" | ||
| rm -rf share/man/man1 | ||
| @echo "Cleaning binaries" | ||
| $(foreach EXE_FILE, $(EXEC_FILES), \ | ||
| rm -f src/$(EXE_FILE) ; \ | ||
| rm -f bin/$(EXE_FILE) ; \ | ||
| ) | ||
| rm -rf Resources/FileHash* | ||
|  | ||
| python_install: python | ||
| @echo "Installing python libraries" | ||
| mkdir -p $(DESTDIR)/lib/$(dir $(PYTHON_SITE)) | ||
| cp -r lib/$(dir $(PYTHON_SITE)) $(DESTDIR)/lib | ||
|  | ||
| manuals: $(man_files) | ||
| ruby_install: | ||
| @echo "Installing ruby libraries" | ||
| $(INSTALL_DIR) -d -m 755 $(DESTDIR)/lib/$(RUBY_SITE) | ||
| cp -r lib/$(RUBY_DIR) $(DESTDIR)/lib/$(RUBY_SITE) | ||
|  | ||
| $(man_files): share/man/man1/%.1: bin/% | ||
| $(MAN_FILES): share/man/man1/%.1: bin/% | ||
| @mkdir -p share/man/man1 | ||
| help2man --name=" " --source="GoboLinux" --no-info $< --output $@ | ||
|  | ||
| $(exec_files): bin/%: src/% | ||
| cp -af $< $@ | ||
| chmod a+x $@ | ||
| manuals: $(MAN_FILES) | ||
|  | ||
| install_manuals: $(MAN_FILES) | ||
| $(INSTALL_DIR) -d -m 755 $(DESTDIR)/share/man/man1 | ||
| $(foreach MAN_FILE, $(MAN_FILES), \ | ||
| $(INSTALL_FILE) -m 644 $(MAN_FILE) $(DESTDIR)/share/man/man1 ; \ | ||
| ) | ||
|  | ||
| install_scripts: | ||
| @echo "Installing scripts" | ||
| $(INSTALL_DIR) -d -m 755 $(DESTDIR)/bin | ||
| $(foreach SCRIPT_FILE, $(SCRIPT_FILES), \ | ||
| $(INSTALL_FILE) -m 755 bin/$(SCRIPT_FILE) $(DESTDIR)/bin ; \ | ||
| ) | ||
|  | ||
| install_data: | ||
| @echo "Installing Data" | ||
| $(INSTALL_DIR) -d -m 755 $(DESTDIR)/Data | ||
| cp -r Data $(DESTDIR) | ||
|  | ||
| install_resources: | ||
| @echo "Installing Resources" | ||
| cp -r Resources $(DESTDIR) | ||
|  | ||
| install_share_data: | ||
| @echo "Installing share data" | ||
| cp -rf share $(DESTDIR) | ||
|  | ||
| src/%: src/%.c | ||
| $(MAKE) -C src | ||
| install_functions: | ||
| @echo "Installing Functions" | ||
| cp -rf Functions $(DESTDIR) | ||
|  | ||
| .PHONY: all python manuals debug clean | ||
| prepare_install: | ||
| @echo "Installing $(PROGRAM) into $(DESTDIR)" | ||
| $(INSTALL_DIR) -m 755 $(DESTDIR) | ||
|  | ||
| install: python $(exec_files) manuals | ||
| @echo "Installing Scripts into $(PREFIX)/$(DESTDIR)" | ||
| @install -d -m 755 $(PREFIX)/$(DESTDIR) | ||
| @echo "Copying files ..." | ||
| @./bin/ListProgramFiles `pwd` | grep -v "^src" | grep -v "^Makefile" | \ | ||
| cpio --pass-through --quiet --verbose --unconditional $(PREFIX)/$(DESTDIR) | ||
| install: all prepare_install install_scripts install_data install_resources install_share_data install_functions python_install ruby_install install_manuals | ||
| @$(MAKE) DESTDIR=$(DESTDIR) -C src install | ||
| @echo "Installed $(PROGRAM) into $(DESTDIR)" | ||
            File renamed without changes.
          
    
            File renamed without changes.
          
    
            File renamed without changes.
          
    This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,55 +1,74 @@ | ||
|  | ||
| MYCFLAGS = -O2 -Wall | ||
| DESTDIR?= | ||
| CC = gcc | ||
| CFLAGS = -O2 -Wall | ||
| INSTALL_FILE=install -s | ||
| INSTALL_DIR=install -d | ||
|  | ||
| STATIC=-static | ||
| ifeq ($(shell uname -s),Darwin) | ||
| STATIC= | ||
| endif | ||
|  | ||
| # Running on windows | ||
| IS_CYGWIN=$(shell uname | grep -i cygwin &>/dev/null && echo yes || echo no) | ||
| ifeq ($(IS_CYGWIN),yes) | ||
| RM_EXE=-rm -f *.exe | ||
| endif | ||
|  | ||
| STATIC_CFLAGS = $(CFLAGS) -static | ||
| ifneq ($(shell uname -s),Darwin) | ||
| STATIC_CFLAGS = $(CFLAGS) | ||
| endif | ||
|  | ||
| # Add compiler options | ||
| ifdef DEBUG | ||
| CFLAGS += -g -DDEBUG | ||
| STATIC_CFLAGS += -g -DDEBUG | ||
| INSTALL_FILE=install | ||
| endif | ||
|  | ||
| exec_files = $(patsubst %.c,%,$(wildcard *.c)) | ||
|  | ||
| dynamic_exec = BackgroundExec SuperUserName IsExecutable usleep LinkOrExpandAll List CommandNotFound GetSupportedFilesystems | ||
| static_exec = RescueSymlinkProgram | ||
| other_exec = FindDependencies Runner | ||
|  | ||
| # first rule | ||
| default: all | ||
|  | ||
| .PHONY: all default | ||
| .PHONY: all clean static debug install | ||
|  | ||
| all: $(dynamic_exec) $(static_exec) $(other_exec) | ||
|  | ||
| $(dynamic_exec): %: %.c | ||
| $(CC) $(MYCFLAGS) $< -o $@ | ||
| @if [ -e "$@.exe" ]; then \ | ||
| @echo "Compiling $@" | ||
| $(CC) $(CFLAGS) $< -o $@ | ||
| if [ -e "$@.exe" ]; then \ | ||
| mv $@.exe $@; \ | ||
| fi | ||
|  | ||
| $(static_exec): %: %.c | ||
| $(CC) $(MYCFLAGS) $< -o $@ $(STATIC) | ||
| @if [ -e "$@.exe" ]; then \ | ||
| @echo "Compiling $@" | ||
| $(CC) $(STATIC_CFLAGS) $< -o $@ | ||
| if [ -e "$@.exe" ]; then \ | ||
| mv $@.exe $@; \ | ||
| fi | ||
|  | ||
| FindDependencies: %: %.c | ||
| $(CC) $(MYCFLAGS) $< -o $@ -DBUILD_MAIN | ||
| @echo "Compiling $@" | ||
| $(CC) $(CFLAGS) $< -o $@ -DBUILD_MAIN | ||
|  | ||
| Runner: Runner.c FindDependencies.c | ||
| $(CC) $(MYCFLAGS) $^ -o $@ | ||
| chmod 4755 $@ | ||
|  | ||
| debug: MYCFLAGS = -g -DDEBUG -Wall | ||
| debug: all | ||
|  | ||
| static: MYCFLAGS = $(STATIC) | ||
| static: all | ||
| @echo "Compiling $@" | ||
| $(CC) $(CFLAGS) $^ -o $@ | ||
|  | ||
| clean: | ||
| @echo "Cleaning sources" | ||
| rm -f $(dynamic_exec) $(static_exec) $(other_exec) lib*.so lib*.so.* *.o | ||
| $(RM_EXE) | ||
|  | ||
| .PHONY: all clean static debug install | ||
| install: all | ||
| @echo "Installing compiled binaries" | ||
| ifndef DESTDIR | ||
| $(error DESTDIR is not set) | ||
| endif | ||
| $(INSTALL_DIR) -d -m 755 $(DESTDIR)/bin | ||
| $(foreach EXEC_FILE, $(exec_files), \ | ||
| $(INSTALL_FILE) -m 755 $(EXEC_FILE) $(DESTDIR)/bin ; \ | ||
| ) | ||
| chmod 4755 $(DESTDIR)/bin/Runner | ||
|  | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason for removing the generation of .pyc files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ops! my bad! Added .pyc files generation again