Fixed the makefile. Fixed the build. Added files needed for builds. Updated ui_unix.h to account for _UI_EXPORT.

This commit is contained in:
Pietro Gagliardi 2015-04-22 15:47:37 -04:00
parent 647b7892ef
commit 3b32ab8625
5 changed files with 39 additions and 21 deletions

View File

@ -27,7 +27,7 @@ HFILES = \
OFILES = \ OFILES = \
$(CFILES:%.c=$(OBJDIR)/%.o) \ $(CFILES:%.c=$(OBJDIR)/%.o) \
$(osCFILES:%.c=$(OBJDIR)/%_$(OS).o) $(osCFILES:%.c=$(OBJDIR)/%.o)
xCFLAGS = \ xCFLAGS = \
-g \ -g \
@ -35,10 +35,12 @@ xCFLAGS = \
-Wno-unused-parameter \ -Wno-unused-parameter \
-Wno-switch \ -Wno-switch \
--std=c99 \ --std=c99 \
-fPIC \
$(CFLAGS) $(CFLAGS)
xLDFLAGS = \ xLDFLAGS = \
-g \ -g \
-fPIC \
$(LDFLAGS) $(LDFLAGS)
OUT = $(OUTDIR)/$(OUTBASE)$(osLIBSUFFIX) OUT = $(OUTDIR)/$(OUTBASE)$(osLIBSUFFIX)
@ -48,34 +50,29 @@ default: $(OUT)
test: $(TEST) test: $(TEST)
.PHONY: default test .PHONY: default test
$(OUT): $(OFILES) $(OUTDIR) $(OUT): $(OFILES) dirs
$(CC) -o $(OUT) $(OFILES) -shared $(xLDFLAGS) $(osLDFLAGS) $(CC) -o $(OUT) $(OFILES) -shared $(xLDFLAGS) $(osLDFLAGS)
$(OBJDIR)/%.o: %.c $(HFILES) $(OBJDIR) $(OBJDIR)/%.o: %.c $(HFILES) $(osHFILES) dirs
$(CC) -o $@ -c $< $(xCFLAGS) $(osCFLAGS) $(CC) -o $@ -c $< $(xCFLAGS) $(osCFLAGS)
$(OBJDIR)/%_$(OS).o: $(OS)/%.c $(HFILES) $(osHFILES) $(OBJDIR) $(TEST): $(OUT) $(TESTOFILES) dirs
$(CC) -o $@ -c $< $(xCFLAGS) $(osCFLAGS)
$(TEST): $(OUT) $(TESTOFILES) $(OUTDIR)
$(CC) -o $(TEST) $(TESTOFILES) $(OUT) $(xLDFLAGS) $(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) $(CC) -o $@ -c $< $(xCFLAGS)
dirs: $(OBJDIR)/.phony $(OBJDIR)/$(OS)/.phony $(OUTDIR)/.phony
.PHONY: dirs
# see http://www.cmcrossroads.com/article/making-directories-gnu-make # see http://www.cmcrossroads.com/article/making-directories-gnu-make
#$(OUTDIR): $(OUTDIR)/phony %/.phony:
#$(OBJDIR): $(OBJDIR)/phony mkdir -p $(dir $@)
#%/phony: touch $@
# mkdir -p $(dir $@)
# touch $@
#.PRECIOUS: $(OUTDIR) $(OUTDIR)/phony
#.PRECIOUS: $(OBJDIR) $(OBJDIR)/phony
$(OUTDIR) $(OBJDIR):
mkdir -p $@
ui.h: ui.idl ui.h: ui.idl
idl2h -extern _UI_EXTERN < ui.idl > ui.h idl2h -extern _UI_EXTERN < ui.idl > ui.h
clean: clean:
rm -rf $(OUTDIR) $(OBJDIR) ui.h rm -rf $(OUTDIR) $(OBJDIR) ui.h
.PHONY: clean

View File

@ -131,14 +131,14 @@ interface Tab from Control {
func NewTab(void) *Tab; func NewTab(void) *Tab;
interface Menu { interface Menu {
func AddItem(name string) *MenuItem; func AddItem(name *const char) *MenuItem;
func AddCheckItem(name string) *MenuItem; func AddCheckItem(name *const char) *MenuItem;
func AddQuitItem(void) *MenuItem; func AddQuitItem(void) *MenuItem;
func AddPreferencesItem(void) *MenuItem; func AddPreferencesItem(void) *MenuItem;
func AddAboutItem(void) *MenuItem; func AddAboutItem(void) *MenuItem;
func AddSeparator(void); func AddSeparator(void);
}; };
func NewMenu(name string) *Menu; func NewMenu(name *const char) *Menu;
interface MenuItem { interface MenuItem {
func Enable(void); func Enable(void);

21
new/ui_unix.h Normal file
View File

@ -0,0 +1,21 @@
// 7 april 2015
/*
This file assumes that you have included <gtk/gtk.h> 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

0
new/uipriv.h Normal file
View File

View File

@ -1,7 +1,7 @@
# 22 april 2015 # 22 april 2015
osCFILES = \ osCFILES = \
main.c unix/main.c
osHFILES = \ osHFILES = \
unix/uipriv_unix.h unix/uipriv_unix.h