Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. comma:= ,
  2. empty:=
  3. space:= $(empty) $(empty)
  4. bracketl:= (
  5. bracketl0:= \(
  6. bracketr:= )
  7. bracketr0:= \)
  8. OUTDIR = output
  9. ROOT_PATH = c:\keil
  10. UTIL_PATH = /home/ast/vol/work/util/
  11. C51BIN = $(ROOT_PATH)\C51\BIN
  12. C51 = $(C51BIN)\c51
  13. A51 = $(C51BIN)\ax51
  14. BL51 = $(C51BIN)\lx51
  15. OH51 = $(C51BIN)\ohx51
  16. OC51 = $(C51BIN)\oc51
  17. LIB51 = $(C51BIN)\lib51
  18. TARGET = $(OUTDIR)\fw
  19. TARGETHEX = $(TARGET).hex
  20. OPT_LEVEL=8
  21. LIST_FILE_CTL=PR($(@:obj=lst))
  22. C_OPTS = object($@) OBJECTADVANCED browse $(LIST_FILE_CTL) \
  23. OT($(OPT_LEVEL),SPEED)
  24. #ASM_OPTS = $(LIST_FILE_CTL) object($@)
  25. ASM_OPTS = SET (small) DEBUG EP $(LIST_FILE_CTL) object($@)
  26. LINK_OPTS = \
  27. SEGMENTS(\
  28. ?STACK(D:0xD0))\
  29. NOOVERLAY \
  30. PAGELENGTH(60000) \
  31. CODE
  32. LINK_OBJ = main packet uart1 usb0 usb0_desc uart0 sdio
  33. LINK_OBJ_TMP = $(addsuffix .obj,$(LINK_OBJ))
  34. LINK_OBJ_DEPENDENCIES = $(addprefix $(OUTDIR)/, $(LINK_OBJ_TMP))
  35. LINK_OBJ_FILES = $(subst $(space),$(comma),$(LINK_OBJ_DEPENDENCIES))
  36. .SUFFIXES: .a51
  37. $(OUTDIR)/%.obj : %.c
  38. $(C51) $< "$(C_OPTS)"
  39. $(OUTDIR)/%.obj : %.a51
  40. $(A51) $< "$(ASM_OPTS)"
  41. all : $(TARGETHEX) e.exe
  42. e : regedr.c
  43. gcc $^ -g -o $@
  44. e.exe : regedr.c
  45. gcc $^ -o $@ -lhid -lsetupapi
  46. geneep : geneep.c
  47. gcc $^ -g -o $@
  48. cp geneep.exe ../rom/util/
  49. geneep.exe : geneep.c
  50. gcc $^ -o $@
  51. $(TARGET) : $(LINK_OBJ_DEPENDENCIES)
  52. $(BL51) "$(LINK_OBJ_FILES) TO $@ $(LINK_OPTS)"
  53. $(TARGETHEX) : $(TARGET)
  54. $(OH51) $(TARGET)
  55. clean:
  56. rm e $(OUTDIR)/*
  57. cleanwin:
  58. del e.exe
  59. del /Q $(OUTDIR)\*.*
  60. ttt :
  61. echo $(ASM_OPTS_CYGWIN)