Advertisement
Chronos_Ouroboros

Mod C source compilation - Makefile

Dec 16th, 2015
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 2.66 KB | None | 0 0
  1. CC = gdcc-cc
  2. LD = gdcc-ld
  3. ML = gdcc-makelib
  4. COM_FLAGS = --bc-target=ZDoom
  5. CC_FLAGS = $(COMFLAGS) -DS7DEBUG
  6.  
  7. SOURCEDIRECTORY = C_Source
  8.  
  9. INCDIR = $(SOURCEDIRECTORY)/inc
  10. SRCDIR = $(SOURCEDIRECTORY)/src
  11. OBJDIR = $(SOURCEDIRECTORY)/obj
  12. LIBDIR = $(OBJDIR)/lib
  13.  
  14. ZDACSDIR = PK3_Source_GZDoom/acs
  15. ZANDROACSDIR = PK3_Source_Zandronum/acs
  16.  
  17. all: $(OBJDIR) $(ZDACSDIR) $(ZANDROACSDIR) $(ZDACSDIR)/Se7evidas.bin $(ZANDROACSDIR)/Se7evidas.bin
  18.  
  19. cleanall:
  20.     rm -rf $(OBJDIR) $(ZDACSDIR) $(ZANDROACSDIR)
  21.  
  22. $(OBJDIR):
  23.     @mkdir "$(OBJDIR)"
  24.     @mkdir "$(OBJDIR)/Common"
  25.     @mkdir "$(OBJDIR)/ZDoom"
  26.     @mkdir "$(OBJDIR)/Zandronum"
  27.     @mkdir "$(OBJDIR)/lib"
  28.  
  29. $(ZDACSDIR):
  30.     @mkdir "$(ZDACSDIR)"
  31.  
  32. $(ZANDROACSDIR):
  33.     @mkdir "$(ZANDROACSDIR)"
  34.  
  35. ## ===========================================
  36. ##
  37. ## Libs
  38. ##
  39. ## ===========================================
  40.  
  41. $(LIBDIR)/libc.ir:
  42.     $(ML) $(COM_FLAGS) -c -o $@ libc
  43.  
  44. $(LIBDIR)/libGDCC.ir:
  45.     $(ML) $(COM_FLAGS) -c -o $@ libGDCC
  46.  
  47. ## ===========================================
  48. ##
  49. ## Se7evidas.bin
  50. ##
  51. ## ===========================================
  52.  
  53. ## Common ##
  54. Common_INCDIR = $(INCDIR)/Common
  55. Common_SRCDIR = $(SRCDIR)/Common
  56. Common_OBJDIR = $(OBJDIR)/Common
  57. Common_SRC = $(wildcard $(Common_SRCDIR)/*.c)
  58. Common_OBJ = $(Common_SRC:$(Common_SRCDIR)/%.c=$(Common_OBJDIR)/%.ir)
  59.  
  60. $(Common_OBJDIR)/%.ir: $(Common_SRCDIR)/%.c
  61.     $(CC) $(CC_FLAGS) -i$(Common_INCDIR) -i$(Common_SRCDIR) -c $< -o $@
  62.  
  63. $(OBJDIR)/Common.ir: $(Common_OBJ)
  64.     $(LD) $(COM_FLAGS) $^ -co $@
  65.  
  66. ## ZDoom ##
  67. ZDoom_INCDIR = $(INCDIR)/ZDoom
  68. ZDoom_SRCDIR = $(SRCDIR)/ZDoom
  69. ZDoom_OBJDIR = $(OBJDIR)/ZDoom
  70. ZDoom_SRC = $(wildcard $(ZDoom_SRCDIR)/*.c)
  71. ZDoom_OBJ = $(ZDoom_SRC:$(ZDoom_SRCDIR)/%.c=$(ZDoom_OBJDIR)/%.ir)
  72.  
  73. $(ZDoom_OBJDIR)/%.ir: $(ZDoom_SRCDIR)/%.c
  74.     $(CC) $(CC_FLAGS) -i$(ZDoom_INCDIR) -i$(Common_INCDIR) -i$(ZDoom_SRCDIR) -c $< -o $@
  75.  
  76. $(OBJDIR)/ZDoom.ir: $(ZDoom_OBJ)
  77.     $(LD) $(COM_FLAGS) $^ -co $@
  78.  
  79. $(ZDACSDIR)/Se7evidas.bin: $(LIBDIR)/libc.ir $(LIBDIR)/libGDCC.ir $(OBJDIR)/Common.ir $(OBJDIR)/ZDoom.ir
  80.     $(LD) $(COM_FLAGS) $^ -o $@
  81.  
  82. ## Zandronum ##
  83. Zandronum_INCDIR = $(INCDIR)/Zandronum
  84. Zandronum_SRCDIR = $(SRCDIR)/Zandronum
  85. Zandronum_OBJDIR = $(OBJDIR)/Zandronum
  86. Zandronum_SRC = $(wildcard $(Zandronum_SRCDIR)/*.c)
  87. Zandronum_OBJ = $(Zandronum_SRC:$(Zandronum_SRCDIR)/%.c=$(Zandronum_OBJDIR)/%.ir)
  88.  
  89. $(Zandronum_OBJDIR)/%.ir: $(Zandronum_SRCDIR)/%.c
  90.     $(CC) $(CC_FLAGS) -i$(Zandronum_INCDIR) -i$(Common_INCDIR) -i$(Zandronum_SRCDIR) -c $< -o $@
  91.  
  92. $(OBJDIR)/Zandronum.ir: $(Zandronum_OBJ)
  93.     $(LD) $(COM_FLAGS) $^ -co $@
  94.  
  95. $(ZANDROACSDIR)/Se7evidas.bin: $(LIBDIR)/libc.ir $(LIBDIR)/libGDCC.ir $(OBJDIR)/Common.ir $(OBJDIR)/Zandronum.ir
  96.     $(LD) $(COM_FLAGS) $^ -o $@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement