Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. summary ?= @true
  9. CCFLAGS:= -I..
  10. LDFLAGS:= -L$(SDK_DIR)/lib -L$(SDK_DIR)/ld -lm -ldl -Wl,-Map=mapfile
  11. CCFLAGS += -Wall
  12. #DEFINES +=
  13. TARGET = host
  14. ifeq ($(FLAVOR),debug)
  15. CCFLAGS += -O0 -g
  16. TARGET_LDFLAGS += -O0 -g
  17. DEFINES += -DDEBUG_COUNTS
  18. else
  19. FLAVOR = release
  20. CCFLAGS += -O2
  21. TARGET_LDFLAGS += -O2
  22. endif
  23. #
  24. # This relies on the files being unique on the vpath
  25. #
  26. SRC := uz_unzip.c uz_zip.c crc32.c uzlib_inflate.c uzlib_deflate.c
  27. vpath %.c .:..
  28. ODIR := .output/$(TARGET)/$(FLAVOR)/obj
  29. CFLAGS = $(CCFLAGS) $(DEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
  30. DFLAGS = $(CCFLAGS) $(DDEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
  31. ROOT = ../../..
  32. CC := $(WRAPCC) gcc
  33. ECHO := echo
  34. IMAGES := $(ROOT)/uz_zip $(ROOT)/uz_unzip
  35. .PHONY: test clean all
  36. all: $(IMAGES)
  37. $(ROOT)/uz_zip : $(ODIR)/uz_zip.o $(ODIR)/crc32.o $(ODIR)/uzlib_deflate.o
  38. $(summary) HOSTLD $@
  39. $(CC) $^ -o $@ $(LDFLAGS)
  40. $(ROOT)/uz_unzip : $(ODIR)/uz_unzip.o $(ODIR)/crc32.o $(ODIR)/uzlib_inflate.o
  41. $(summary) HOSTLD $@
  42. $(CC) $^ -o $@ $(LDFLAGS)
  43. test :
  44. @echo CC: $(CC)
  45. @echo SRC: $(SRC)
  46. @echo DEPS: $(DEPS)
  47. clean :
  48. $(RM) -r $(ODIR)
  49. $(RM) $(IMAGES)
  50. $(ODIR)/%.o: %.c
  51. @mkdir -p $(ODIR);
  52. $(summary) HOSTCC $(CURDIR)/$<
  53. $(CC) $(CFLAGS) -o $@ -c $<