Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Copyright (c) 2009 Openmoko Inc.
  2. #
  3. # This program is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. # +++START_UPDATE_MAKEFILE: Start of auto included code
  16. # The text between the +++ and --- tags is copied by the
  17. # UpdateMakefiles script. Do not remove or change these tags.
  18. # ---
  19. # Autodetect root directory
  20. define FIND_ROOT_DIR
  21. while : ; do \
  22. d=$$(pwd) ; \
  23. [ -d "$${d}/samo-lib" ] && echo $${d} && exit 0 ; \
  24. [ X"/" = X"$${d}" ] && echo ROOT_DIRECTORY_NOT_FOUND && exit 1 ; \
  25. cd .. ; \
  26. done
  27. endef
  28. ROOT_DIR := $(shell ${FIND_ROOT_DIR})
  29. # Directory of Makefile includes
  30. MK_DIR := ${ROOT_DIR}/samo-lib/Mk
  31. # Include the initial Makefile setup
  32. include ${MK_DIR}/definitions.mk
  33. # ---END_UPDATE_MAKEFILE: End of auto included code
  34. CC = gcc
  35. LD = ld
  36. CFLAGS = -g -O3 -Wall -MD -D_REENTRANT -DWIKIPCF -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
  37. CFLAGS += -I. -I$(WIKI_APP_INCLUDE)
  38. LDFLAGS = -g -dynamic
  39. TARGETS = hash-gen
  40. vpath %.c $(WIKI_APP_SRC)
  41. OBJS = main.o
  42. OBJS += hash.o
  43. OBJS += bigram.o
  44. OBJS += search_hash.o
  45. .PHONY: all
  46. all: ${TARGETS}
  47. .PHONY: install
  48. install: all
  49. hash-gen: ${OBJS}
  50. ${CC} ${LDFLAGS} ${OBJS} -o $@
  51. build:
  52. ${MKDIR} "$@"
  53. .PHONY: clean
  54. clean:
  55. ${RM} -r build ${TARGETS} *.o *.d