Makefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #
  2. # This Make file is called from the core Makefile hierarchy with is a hierarchical
  3. # make wwhich uses parent callbacks to implement inheritance. However is luac_cross
  4. # build stands outside this and uses the host toolchain to implement a separate
  5. # host build of the luac.cross image.
  6. #
  7. .NOTPARALLEL:
  8. CCFLAGS:= -I..
  9. LDFLAGS:= -L$(SDK_DIR)/lib -L$(SDK_DIR)/ld -lm -ldl -Wl,-Map=mapfile
  10. CCFLAGS += -Wall
  11. #DEFINES +=
  12. TARGET = host
  13. ifeq ($(FLAVOR),debug)
  14. CCFLAGS += -O0 -g
  15. TARGET_LDFLAGS += -O0 -g
  16. DEFINES += -DDEBUG_COUNTS
  17. else
  18. FLAVOR = release
  19. CCFLAGS += -O2
  20. TARGET_LDFLAGS += -O2
  21. endif
  22. #
  23. # This relies on the files being unique on the vpath
  24. #
  25. SRC := uz_unzip.c uz_zip.c crc32.c uzlib_inflate.c uzlib_deflate.c
  26. vpath %.c .:..
  27. ODIR := .output/$(TARGET)/$(FLAVOR)/obj
  28. CFLAGS = $(CCFLAGS) $(DEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
  29. DFLAGS = $(CCFLAGS) $(DDEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
  30. ROOT = ../../..
  31. CC := gcc
  32. ECHO := echo
  33. IMAGES := $(ROOT)/uz_zip $(ROOT)/uz_unzip
  34. .PHONY: test clean all
  35. all: $(IMAGES)
  36. $(ROOT)/uz_zip : $(ODIR)/uz_zip.o $(ODIR)/crc32.o $(ODIR)/uzlib_deflate.o
  37. $(CC) $^ -o $@ $(LDFLAGS)
  38. $(ROOT)/uz_unzip : $(ODIR)/uz_unzip.o $(ODIR)/crc32.o $(ODIR)/uzlib_inflate.o
  39. $(CC) $^ -o $@ $(LDFLAGS)
  40. test :
  41. @echo CC: $(CC)
  42. @echo SRC: $(SRC)
  43. @echo DEPS: $(DEPS)
  44. clean :
  45. $(RM) -r $(ODIR)
  46. $(RM) $(IMAGES)
  47. $(ODIR)/%.o: %.c
  48. @mkdir -p $(ODIR);
  49. $(CC) $(CFLAGS) -o $@ -c $<