2015-05-14 08:43:25 -05:00
|
|
|
# 22 april 2015
|
|
|
|
|
|
|
|
OUTBASE = new
|
|
|
|
OUTDIR = out
|
|
|
|
OBJDIR = .obj
|
|
|
|
|
|
|
|
IDLFILES = \
|
|
|
|
ui.idl \
|
|
|
|
$(baseIDLFILES)
|
|
|
|
|
|
|
|
xHFILES = \
|
|
|
|
uipriv.h \
|
|
|
|
$(IDLFILES:%.idl=$(OUTDIR)/%.h) \
|
|
|
|
$(baseHFILES)
|
|
|
|
|
|
|
|
OFILES = \
|
|
|
|
$(baseCFILES:%.c=$(OBJDIR)/%.o) \
|
2015-05-17 17:53:06 -05:00
|
|
|
$(IDLFILES:%.idl=$(OBJDIR)/z%typefuncs.o) \
|
2015-05-14 08:43:25 -05:00
|
|
|
$(baseMFILES:%.m=$(OBJDIR)/%.o)
|
|
|
|
|
|
|
|
xCFLAGS = \
|
|
|
|
-g \
|
|
|
|
-Wall -Wextra \
|
|
|
|
-Wno-unused-parameter \
|
|
|
|
-Wno-switch \
|
|
|
|
--std=c99 \
|
|
|
|
$(CFLAGS) \
|
|
|
|
$(archmflag) \
|
|
|
|
$(baseCFLAGS)
|
|
|
|
|
|
|
|
xLDFLAGS = \
|
|
|
|
-g \
|
|
|
|
$(LDFLAGS) \
|
|
|
|
$(archmflag) \
|
|
|
|
$(baseLDFLAGS)
|
|
|
|
|
|
|
|
OUT = $(OUTDIR)/$(OUTBASE)$(baseSUFFIX)
|
|
|
|
|
|
|
|
$(OUT): $(OFILES) | $(OUTDIR)/.phony
|
|
|
|
@$(CC) -o $(OUT) $(OFILES) $(xLDFLAGS)
|
|
|
|
@echo ====== Linked $(OUT)
|
|
|
|
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
$(OBJDIR)/%.o: %.c $(xHFILES) | $$(dir $$@).phony
|
|
|
|
@$(CC) -o $@ -c $< $(xCFLAGS)
|
|
|
|
@echo ====== Compiled $<
|
|
|
|
|
|
|
|
$(OBJDIR)/%.o: %.m $(xHFILES) | $$(dir $$@).phony
|
|
|
|
@$(CC) -o $@ -c $< $(xCFLAGS)
|
|
|
|
@echo ====== Compiled $<
|
|
|
|
|
|
|
|
# see http://www.cmcrossroads.com/article/making-directories-gnu-make
|
|
|
|
%/.phony:
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@touch $@
|
|
|
|
.PRECIOUS: %/.phony
|
|
|
|
|
|
|
|
$(OUTDIR)/%.h: %.idl tools/idl2h.go | $(OUTDIR)/.phony
|
|
|
|
@go run tools/idl2h.go -extern _UI_EXTERN -guard __UI_UI_H__ < $< > $@
|
|
|
|
@echo ====== Generated `basename $@`
|
2015-05-16 10:39:18 -05:00
|
|
|
.PRECIOUS: $(OUTDIR)/%.h
|
2015-05-14 08:43:25 -05:00
|
|
|
|
2015-05-17 17:53:06 -05:00
|
|
|
z%typefuncs.c: %.idl tools/idl2typefuncs.go
|
|
|
|
@go run tools/idl2typefuncs.go out/ui.h < $< > $@
|
|
|
|
@echo ====== Generated $@
|
|
|
|
.PRECIOUS: z%typefuncs.c
|
|
|
|
|
2015-05-14 08:43:25 -05:00
|
|
|
clean:
|
2015-05-17 17:53:06 -05:00
|
|
|
rm -rf $(OUTDIR) $(OBJDIR) z*
|
2015-05-14 08:43:25 -05:00
|
|
|
.PHONY: clean
|