1# 2# This is a simple Makefile for one level c++ addons. 3# 4# Gaspar Sinai <gaspar@yudit.org> 5# 2020-05-04, Tokyo 6# 7# If you see broken links here this is beta version. 8# 9include ../Makefile.conf 10 11SOURCES=$(wildcard */*.cpp) 12 13# 14# In case you have those addons. 15# 16SYNTAX=../../syntax-1.1 17TRUETYPE=../../truetype-1.9 18YUDIT_SEDY=../../yudit_sedy-0.7.2 19 20 21ifeq ($(SPLATFORM),WINDOWS) 22OBJS=$(subst .cpp,.obj,$(SOURCES)) 23TARGET=addon.lib 24else 25OBJS=$(subst .cpp,.o,$(SOURCES)) 26TARGET=libaddon.a 27endif 28 29.PHONY: copy 30 31SUBDIRS=$(sort $(dir $(SOURCES))) 32SUBDIR_CPP_FLAGS=$(patsubst %,-I$(TOPDIR)/addon/%,$(SUBDIRS)) 33 34 35CPPFLAGS:=$(CPPFLAGS) -DNO_MAIN 36 37all: $(TARGET) 38 39addon.lib: $(OBJS) 40 $(AR)$@ $(OBJS) 41 42libaddon.a: $(OBJS) 43 $(AR) $@ $(OBJS) 44 $(RANLIB) $@ 45 46%.o:%.cpp 47 $(CXX) -c -o $@ $(SUBDIR_CPP_FLAGS) $(CPPFLAGS) $(patsubst %.o,%.cpp,$@) 48 49#Windows will create it in local, we need to move it 50%.obj:%.cpp 51 $(CXX) -c $(SUBDIR_CPP_FLAGS) $(CPPFLAGS) $(patsubst %.obj,%.cpp,$@) 52 mv $(@F) $(@D) 53 54depend: 55 $(CXX) -M $(SUBDIR_CPP_FLAGS) $(CPPFLAGS) $(patsubst %.o,%.cpp,$(OBJS)) > .depend 56 57clean: 58 rm -f $(wildcard */*.o) $(wildcard */*.obj) $(TARGET) .depend 59 60distclean: clean 61 rm -rf syntax truetype yudit_sedy 62 63copy: 64ifneq (,$(wildcard $(YUDIT_SEDY)/*)) 65 cp -R $(YUDIT_SEDY) yudit_sedy 66 rm -rf yudit_sedy/*.obj yudit_sedy/*.o 67else 68 @echo WARNING yudit_sedy plugin skipped. 69endif 70ifneq (,$(wildcard $(SYNTAX)/*)) 71 cp -R $(SYNTAX) syntax 72 rm -rf syntax/src 73else 74 @echo WARNING syntax plugin skipped. 75endif 76ifneq (,$(wildcard $(TRUETYPE)/*)) 77 cp -R $(TRUETYPE) truetype 78 rm -rf truetype/reduced 79 rm -rf truetype/candidate 80else 81 @echo WARNING truetype plugin skipped. 82endif 83 84 85install: 86 87# This is called by bin/wininst on windows. 88wininst_fonts: 89ifneq (,$(wildcard truetype/target/*)) 90 cp -R truetype/target/* $(INSTALLDIR)/fonts 91else 92 @echo WARNING truetype plugin skipped. 93endif 94 95wininst_syntax: 96ifneq (,$(wildcard syntax/target/*)) 97 cp -R syntax/target/* $(INSTALLDIR)/syntax 98else 99 @echo WARNING syntax plugin skipped 100endif 101 102ifeq (.depend, $(wildcard .depend)) 103include .depend 104endif 105