Makefile 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. #-------------------------------------------------------------------------------
  2. #- --
  3. #- This software is confidential and proprietary and may be used --
  4. #- only as expressly authorized by a licensing agreement from --
  5. #- --
  6. #- Hantro Products Oy. --
  7. #- --
  8. #- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. #- ALL RIGHTS RESERVED --
  10. #- --
  11. #- The entire notice above must be reproduced --
  12. #- on all copies and should not be removed. --
  13. #- --
  14. #-------------------------------------------------------------------------------
  15. #-
  16. #-- Abstract : Makefile for encoder testbench
  17. #--
  18. #-------------------------------------------------------------------------------
  19. # Comment/uncomment the following line to disable/enable debugging
  20. DEBUG = y
  21. # Include API extension and test ID for Hantro internal testing
  22. INTERNAL_TEST = y
  23. # set this to 'y' for Electric Fence checking
  24. USE_EFENCE = n
  25. # Add your debugging flag (or not) to CFLAGS
  26. ifeq ($(DEBUG),y)
  27. DEBFLAGS = -O1 -g -DDEBUG
  28. else
  29. DEBFLAGS = -O2 -DNDEBUG
  30. endif
  31. #DEBFLAGS+=-DNO_OUTPUT_WRITE
  32. # Architecture flags for gcc
  33. #ARCH =
  34. #CROSS_COMPILE =
  35. ifeq ($(shell uname -m),x86_64)
  36. ifneq (,$(findstring pclinux,$(MAKECMDGOALS)))
  37. export ARCH = -m32
  38. endif
  39. ifneq (,$(findstring system,$(MAKECMDGOALS)))
  40. export ARCH = -m32
  41. endif
  42. ifneq (,$(findstring testdata,$(MAKECMDGOALS)))
  43. export ARCH = -m32
  44. endif
  45. ifneq (,$(findstring eval,$(MAKECMDGOALS)))
  46. export ARCH = -m32
  47. endif
  48. endif
  49. # the path where to find header files
  50. INCFLAGS = -I../../../inc -I../../../source/h264 \
  51. -I../../../source/common -I../../../source/camstab \
  52. -I../../debug_trace
  53. ifeq ($(USE_EFENCE), y)
  54. EFENCE= -DUSE_EFENCE -I/afs/hantro.com/projects/adder/users/atna/efence_2_4_13 \
  55. -L/afs/hantro.com/projects/adder/users/atna/efence_2_4_13 \
  56. -lefence -lpthread
  57. endif
  58. CC = $(CROSS_COMPILE)gcc
  59. # compiler switches
  60. CFLAGS = $(ARCH) -Wall -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 \
  61. $(DEBFLAGS) $(INCFLAGS)
  62. # list of used sourcefiles
  63. SRCS = H264TestBench.c EncGetOption.c
  64. ifeq ($(INTERNAL_TEST),y)
  65. # for internal tests
  66. SRCS += h264encapi_ext.c
  67. CFLAGS += -DINTERNAL_TEST
  68. endif
  69. vpath %.c
  70. vpath %.c ../../../source/h264
  71. OBJS = $(SRCS:.c=.o)
  72. # name of the control code library
  73. LIB = ../../lib8290enc.a
  74. # System model library
  75. MODELLIB = ../../../../system/models/enc8290_asic_model.a
  76. # System model library that writes test data traces
  77. TESTDATALIB = ../../../../system/models/enc8290_asic_model_trace.a
  78. # name of the output executable
  79. TARGET = h264_testenc
  80. # MACRO for cleaning object -files
  81. RM = rm -f
  82. #Here are rules for building codes and generating executable
  83. all: tags
  84. @echo ---------------------------------------
  85. @echo "Usage: make [ system | testdata | eval | versatile ]"
  86. @echo "system - PC system model (== pclinux)"
  87. @echo "testdata - PC system model for test data creation"
  88. @echo "eval - PC system model for evaluation with frame limit"
  89. @echo "integrator - ARM integrator with FPGA HW"
  90. @echo "versatile - ARM versatile with FPGA HW"
  91. @echo "NOTE! Make sure to do 'make libclean'"
  92. @echo "between compiling to different targets!"
  93. @echo ---------------------------------------
  94. # Use other makefiles to build the libraries
  95. $(MODELLIB):
  96. $(MAKE) -w -C ../../../../system/models
  97. $(TESTDATALIB):
  98. $(MAKE) -w -C ../../../../system/models testdata
  99. $(LIB):
  100. $(MAKE) -w -C ../.. $(TARGETENV) INCLUDE_JPEG=n \
  101. INCLUDE_VIDSTAB=y USE_EFENCE=$(USE_EFENCE)
  102. .PHONY: eval
  103. evaluation: eval
  104. eval: TARGET = h264_enc_8290_eval
  105. eval: TARGETENV = eval
  106. eval: CFLAGS += -DEVALUATION_LIMIT=1000 -DPSNR
  107. eval: $(MODELLIB) $(LIB) $(OBJS)
  108. $(CC) $(CFLAGS) $(OBJS) $(LIB) $(MODELLIB) -lm -o $(TARGET)
  109. pclinux: system
  110. .PHONY: system
  111. system: TARGETENV = system
  112. system: CFLAGS += -DPSNR
  113. system: $(MODELLIB) $(LIB) $(OBJS)
  114. $(CC) $(CFLAGS) $(OBJS) $(LIB) $(MODELLIB) -lm -o $(TARGET)
  115. .PHONY: testdata
  116. testdata: TARGETENV = testdata
  117. testdata: CFLAGS += -DPSNR
  118. testdata: $(TESTDATALIB) $(LIB) $(OBJS)
  119. $(CC) $(CFLAGS) $(OBJS) $(LIB) $(TESTDATALIB) -lm -o $(TARGET)
  120. .PHONY: versatile
  121. versatile: TARGETENV = versatile
  122. versatile: CROSS_COMPILE = arm-none-linux-gnueabihf-
  123. versatile: ARCH = -mcpu=arm926ej-s -mtune=arm926ej-s
  124. versatile: LIB += -lpthread
  125. versatile: $(OBJS)
  126. $(MAKE) -w -C ../.. $@ INCLUDE_JPEG=n INCLUDE_VIDSTAB=y \
  127. USE_EFENCE=$(USE_EFENCE) CROSS_COMPILE=$(CROSS_COMPILE) ARCH="$(ARCH)"
  128. $(CC) $(CFLAGS) $(OBJS) $(LIB) $(EFENCE) -o $(TARGET)
  129. .PHONY: versatile_multifile
  130. versatile_multifile: TARGETENV = versatile
  131. versatile_multifile: CROSS_COMPILE = arm-none-linux-gnueabi-
  132. versatile_multifile: ARCH = -mcpu=arm926ej-s -mtune=arm926ej-s
  133. versatile_multifile: LIB += -lpthread
  134. versatile_multifile: CFLAGS += -DMULTIFILEINPUT
  135. versatile_multifile: TARGET = h264_testenc_multifile
  136. versatile_multifile: $(OBJS)
  137. $(MAKE) -w -C ../.. versatile INCLUDE_JPEG=n INCLUDE_VIDSTAB=y \
  138. USE_EFENCE=$(USE_EFENCE) CROSS_COMPILE=$(CROSS_COMPILE) ARCH="$(ARCH)"
  139. $(CC) $(CFLAGS) $(OBJS) $(LIB) $(EFENCE) -o $(TARGET)
  140. .PHONY: integrator
  141. integrator: TARGETENV = integrator
  142. integrator: CROSS_COMPILE= arm-linux-
  143. integrator: ARCH = -mcpu=arm9tdmi -mtune=arm9tdmi
  144. integrator: LIB += -lpthread
  145. integrator: $(OBJS)
  146. $(MAKE) -w -C ../.. $@ INCLUDE_JPEG=n INCLUDE_VIDSTAB=y \
  147. USE_EFENCE=$(USE_EFENCE) CROSS_COMPILE=$(CROSS_COMPILE) ARCH="$(ARCH)"
  148. $(CC) $(CFLAGS) $(OBJS) $(LIB) $(EFENCE) -o $(TARGET)
  149. .PHONY: pci
  150. pci: TARGETENV = pci
  151. pci: CROSS_COMPILE=
  152. pci: ARCH=
  153. pci: CFLAGS+= -DSDRAM_LM_BASE=$(CHW_BASE_ADDRESS) \
  154. -DENC_MODULE_PATH=\"/tmp/dev/hx280\" \
  155. -DMEMALLOC_MODULE_PATH=\"/tmp/dev/memalloc\"
  156. pci: $(LIB) $(OBJS)
  157. $(CC) $(CFLAGS) $(OBJS) $(LIB) -o $(TARGET)
  158. system_cov: CC = covc --retain -t!H264TestBench.c,!EncGetOption.c g++
  159. system_cov: TARGETENV = system_cov
  160. system_cov: $(MODELLIB) $(LIB) $(OBJS)
  161. $(CC) $(CFLAGS) $(OBJS) $(LIB) $(MODELLIB) -o $(TARGET)
  162. .PHONY: clean
  163. clean:
  164. $(RM) *.o core* *~ $(TARGET) $(TARGET).*
  165. .PHONY: libclean
  166. libclean: clean
  167. $(MAKE) -w -C ../.. clean
  168. .PHONY: tags
  169. tags:
  170. ctags ../../../inc/*.h *.c ../../../source/h264/*.[ch] \
  171. ../../../source/common/*.[ch] ../../ewl/*c