Advertisement
Guest User

Makefile for simple "hello" C Program

a guest
Mar 2nd, 2014
210
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.44 KB | None
  1.  
  2. .PHONY: install uninstall clean run auto autoinstall
  3.  
  4. # vars
  5.  
  6. NAME = hello
  7. INSTALL = /home/Administrator
  8.  
  9. # macro
  10.  
  11. auto: run
  12. install: $(INSTALL)/$(NAME)
  13.  
  14. # targets
  15.  
  16. $(NAME): $(NAME).c
  17.     gcc $(NAME).c -o $(NAME)
  18.  
  19. $(INSTALL)/$(NAME): $(NAME)
  20.     cp $(NAME) "$(INSTALL)"
  21.  
  22. # commands
  23.  
  24. autoinstall: $(INSTALL)/$(NAME)
  25.     "$(INSTALL)/$(NAME)"
  26.  
  27. run: $(NAME)
  28.     ./$(NAME)
  29.  
  30. uninstall:
  31.     rm -f "$(INSTALL)/$(NAME)"
  32.  
  33. clean:
  34.     rm -f $(NAME)
Advertisement
RAW Paste Data Copied
Advertisement