From 3b32ab8625f6a045d0d0b5b5fd109bda61fc88ec Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 22 Apr 2015 15:47:37 -0400 Subject: [PATCH] Fixed the makefile. Fixed the build. Added files needed for builds. Updated ui_unix.h to account for _UI_EXPORT. --- new/GNUmakefile | 31 ++++++++++++++----------------- new/ui.idl | 6 +++--- new/ui_unix.h | 21 +++++++++++++++++++++ new/uipriv.h | 0 new/unix/GNUmakeinc.mk | 2 +- 5 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 new/ui_unix.h create mode 100644 new/uipriv.h diff --git a/new/GNUmakefile b/new/GNUmakefile index 472fe3eb..e86af690 100644 --- a/new/GNUmakefile +++ b/new/GNUmakefile @@ -27,7 +27,7 @@ HFILES = \ OFILES = \ $(CFILES:%.c=$(OBJDIR)/%.o) \ - $(osCFILES:%.c=$(OBJDIR)/%_$(OS).o) + $(osCFILES:%.c=$(OBJDIR)/%.o) xCFLAGS = \ -g \ @@ -35,10 +35,12 @@ xCFLAGS = \ -Wno-unused-parameter \ -Wno-switch \ --std=c99 \ + -fPIC \ $(CFLAGS) xLDFLAGS = \ -g \ + -fPIC \ $(LDFLAGS) OUT = $(OUTDIR)/$(OUTBASE)$(osLIBSUFFIX) @@ -48,34 +50,29 @@ default: $(OUT) test: $(TEST) .PHONY: default test -$(OUT): $(OFILES) $(OUTDIR) +$(OUT): $(OFILES) dirs $(CC) -o $(OUT) $(OFILES) -shared $(xLDFLAGS) $(osLDFLAGS) -$(OBJDIR)/%.o: %.c $(HFILES) $(OBJDIR) +$(OBJDIR)/%.o: %.c $(HFILES) $(osHFILES) dirs $(CC) -o $@ -c $< $(xCFLAGS) $(osCFLAGS) -$(OBJDIR)/%_$(OS).o: $(OS)/%.c $(HFILES) $(osHFILES) $(OBJDIR) - $(CC) -o $@ -c $< $(xCFLAGS) $(osCFLAGS) - -$(TEST): $(OUT) $(TESTOFILES) $(OUTDIR) +$(TEST): $(OUT) $(TESTOFILES) dirs $(CC) -o $(TEST) $(TESTOFILES) $(OUT) $(xLDFLAGS) -$(OBJDIR)/%_test.o: test/%.c ui.h $(OBJDIR) +$(OBJDIR)/%_test.o: test/%.c ui.h dirs $(CC) -o $@ -c $< $(xCFLAGS) +dirs: $(OBJDIR)/.phony $(OBJDIR)/$(OS)/.phony $(OUTDIR)/.phony +.PHONY: dirs + # see http://www.cmcrossroads.com/article/making-directories-gnu-make -#$(OUTDIR): $(OUTDIR)/phony -#$(OBJDIR): $(OBJDIR)/phony -#%/phony: -# mkdir -p $(dir $@) -# touch $@ -#.PRECIOUS: $(OUTDIR) $(OUTDIR)/phony -#.PRECIOUS: $(OBJDIR) $(OBJDIR)/phony -$(OUTDIR) $(OBJDIR): - mkdir -p $@ +%/.phony: + mkdir -p $(dir $@) + touch $@ ui.h: ui.idl idl2h -extern _UI_EXTERN < ui.idl > ui.h clean: rm -rf $(OUTDIR) $(OBJDIR) ui.h +.PHONY: clean diff --git a/new/ui.idl b/new/ui.idl index a619600c..4f54b9fa 100644 --- a/new/ui.idl +++ b/new/ui.idl @@ -131,14 +131,14 @@ interface Tab from Control { func NewTab(void) *Tab; interface Menu { - func AddItem(name string) *MenuItem; - func AddCheckItem(name string) *MenuItem; + func AddItem(name *const char) *MenuItem; + func AddCheckItem(name *const char) *MenuItem; func AddQuitItem(void) *MenuItem; func AddPreferencesItem(void) *MenuItem; func AddAboutItem(void) *MenuItem; func AddSeparator(void); }; -func NewMenu(name string) *Menu; +func NewMenu(name *const char) *Menu; interface MenuItem { func Enable(void); diff --git a/new/ui_unix.h b/new/ui_unix.h new file mode 100644 index 00000000..dcc2336a --- /dev/null +++ b/new/ui_unix.h @@ -0,0 +1,21 @@ +// 7 april 2015 + +/* +This file assumes that you have included and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls on Unix systems that use GTK+ to provide their UI (currently all except Mac OS X). +*/ + +#ifndef __UI_UI_UNIX_H__ +#define __UI_UI_UNIX_H__ + +// uiUnixNewControl() creates a new uiControl with the given GTK+ control inside, storing it in the uiControl at c. +// The second parameter is the type of the control, as passed to the first argument of g_object_new(). +// The two scrolledWindow parameters allow placing scrollbars on the new control. +// The destroy parameters are for a function that should be called when destroying the widget. +// The firstProperty parameter and beyond allow passing construct properties to the new control, as with g_object_new(); end this list with NULL. +_UI_EXTERN void uiUnixNewControl(uiControl *c, GType type, gboolean inScrolledWindow, gboolean scrolledWindowHasBorder, void (*destroy)(void *), void *onDestroyData, const char *firstProperty, ...); + +struct uiSizingSys { + // this structure currently left blank +}; + +#endif diff --git a/new/uipriv.h b/new/uipriv.h new file mode 100644 index 00000000..e69de29b diff --git a/new/unix/GNUmakeinc.mk b/new/unix/GNUmakeinc.mk index b9ecd70e..1371d0dd 100644 --- a/new/unix/GNUmakeinc.mk +++ b/new/unix/GNUmakeinc.mk @@ -1,7 +1,7 @@ # 22 april 2015 osCFILES = \ - main.c + unix/main.c osHFILES = \ unix/uipriv_unix.h