SHARE
TWEET

Untitled

a guest Jul 21st, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. TARGET  =       AR1020
  2. CC      =       gcc
  3. CFLAGS  =       -Wall -std=c99 -I./inc/
  4. LINKER  =       gcc -o
  5. LFLAGS  =       -Wall -static -I./inc/
  6.  
  7.  
  8. SRCDIR  =       src
  9. INCDIR  =       inc
  10. OBJDIR  =       obj
  11. BINDIR  =       bin
  12.  
  13. LIBDIR  =       ./lib
  14. LIBFLAG =       -li2c
  15.  
  16.  
  17. SOURCES         :=      $(wildcard $(SRCDIR)/*.c)
  18. INCLUDES        :=      $(wildcard $(INCDIR)/*.h)
  19. OBJECTS         :=      $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
  20. rm              =       rm -f
  21.  
  22. $(BINDIR)/$(TARGET): $(OBJECTS)
  23.         @$(LINKER) $@ $(LFLAGS) -L$(LIBDIR) $(LIBFLAG) $(OBJECTS)
  24.         @echo "Linking complete!"
  25.  
  26. $(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
  27.         @$(CC) $(CFLAGS) -c $< -o $@
  28.         @echo "Compiled "$<" successfully"
  29.  
  30. .PHONY: clean
  31. clean:
  32.         @$(rm) $(OBJECTS)
  33.     @echo "Cleanup complete!"
  34.  
  35. .PHONY: remove
  36. remove: clean
  37.         @$(rm) $(BINDIR)/$(TARGET)
  38.         @echo "Exacutable removed!"
  39.      
  40. |-- bin
  41. |-- inc
  42. |   |-- color.h
  43. |   |-- EXT.h
  44. |   |-- EXT.h~
  45. |   |-- gpio_lib.h
  46. |   `-- test.h
  47. |-- lib
  48. |   |-- i2c.c
  49. |   |-- i2c.o
  50. |   `-- libi2c.a
  51. |-- Makefile
  52. |-- obj
  53. |   |-- AR1020.o
  54. |   |-- gpio_lib.o
  55. |   |-- gpio.o
  56. |   `-- test.o
  57. `-- src
  58.     |-- AR1020.c
  59.     |-- gpio_lib.c
  60.     `-- libi2c.a
  61.      
  62. gcc src/AR1020.c lib/libi2c.a
  63.      
  64. @$(LINKER) $@ $(LFLAGS) -L$(LIBDIR) $(LIBFLAG) $(OBJECTS)
  65.      
  66. @$(LINKER) $@ $(LFLAGS) -L$(LIBDIR)  $(OBJECTS) $(LIBFLAG)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top