Compile.make 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # for i18N support
  2. NLS_CFLAGS = -DPACKAGE=\"$(PACKAGE)\"
  3. LINK = $(CC)
  4. ifeq ($(MANIFEST),external)
  5. PRELINK=$(MAKE) $@.manifest
  6. else
  7. ifeq ($(MANIFEST),internal)
  8. PRELINK=$(MAKE) $(MANIFEST_OBJ)
  9. else
  10. PRELINK=:
  11. endif
  12. endif
  13. linker_base = $(PRELINK) && $(1) $(2) -o $@ $(filter %.o,$^) $(filter %.res,$^) $(3)
  14. linker_x = $(call linker_base,$(1),$(LDFLAGS),$(FMODE_OBJ) $(MANIFEST_OBJ) $(LIBES) $(EXTRA_LDFLAGS) $(EXTRA_LIBS) $(MATHLIB))
  15. linker_c = $(call linker_x,$(CC))
  16. linker_cxx = $(call linker_x,$(CXX))
  17. linker = $(call linker_x,$(LINK))
  18. ALL_CFLAGS = $(LFS_CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(DEFS) $(EXTRA_INC) $(INC) -DRELDIR=\"$(RELDIR)\"
  19. compiler_x = $(1) $(2) $(ALL_CFLAGS) -o $@ -c $<
  20. compiler_c = $(call compiler_x,$(CC),$(COMPILE_FLAGS_C) $($*_c_FLAGS))
  21. compiler_cxx = $(call compiler_x,$(CXX),$(COMPILE_FLAGS_CXX) $($*_cxx_FLAGS))
  22. compiler = $(call compiler_x,$(CC))
  23. # default cc rules
  24. $(OBJDIR)/%.o : %.c $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
  25. $(call compiler_c)
  26. $(OBJDIR)/%.o : %.cpp $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
  27. $(call compiler_cxx)
  28. # default parser generation rules, include prefix for files/vars
  29. %.yy.c: %.l
  30. $(LEX) $(LFLAGS) -t $< > $@
  31. %.output %.tab.h %.tab.c: %.y
  32. $(YACC) -b$* $(YFLAGS) $<
  33. depend: $(C_SOURCES) $(CC_SOURCES) $(CPP_SOURCES)
  34. -$(CC) -E -MM -MG $(ALL_CFLAGS) $^ | sed 's!^[0-9a-zA-Z_.-]*\.o:!$$(OBJDIR)/&!' > $(DEPFILE)
  35. %.manifest.res: %.manifest.rc %.exe.manifest
  36. $(WINDRES) --input=$< --input-format=rc --output=$@ --output-format=coff -I$(MODULE_TOPDIR)/mswindows
  37. %.manifest.rc: $(MODULE_TOPDIR)/mswindows/generic.manifest.rc
  38. sed -e 's/@CMD@/$(notdir $*)/' \
  39. -e 's/@VER_MAJOR@/$(GRASS_VERSION_MAJOR)/' \
  40. -e 's/@VER_MINOR@/$(GRASS_VERSION_MINOR)/' \
  41. -e 's/@VER_RELEASE@/$(GRASS_VERSION_RELEASE)/' \
  42. $(MODULE_TOPDIR)/mswindows/generic.manifest.rc > $@
  43. %.exe.manifest: $(MODULE_TOPDIR)/mswindows/generic.manifest
  44. sed 's/@CMD@/$(notdir $*)/' $(MODULE_TOPDIR)/mswindows/generic.manifest > $@
  45. -include $(DEPFILE)