SimpleText DAY 2+ ソースコード

Makefile



CC = gcc -Wall
CFLAGS = `pkg-config --cflags gtk+-2.0`
LDFLAGS = `pkg-config --libs-only-L gtk+-2.0`
LIBS = `pkg-config --libs-only-l gtk+-2.0 gthread-2.0`
SRCS = main.c support.c #ソースファイル名
OBJS = $(SRCS:.c=.o)
PROGRAM = SimpleText #出力ファイル名
all: $(PROGRAM)
$(PROGRAM): $(OBJS) $(HDRS)
$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $(PROGRAM)
#.PHONY clean: @rm -rf *.o *~ $(PROGRAM)
### End of Makefile
! $(CC)の手前の空白はtabです。
`は、シングルクォートではなく、バッククォートです。(日本語キーボードならshift + @)
このMakefile
http://www.iim.ics.tut.ac.jp/~sugaya/books/GUI-ApplicationProgramming/
で公開されているサンプルプログラムに添付されているものに手を加えたものです。


main.c



/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/

#ifdef HAVE_CONFIG_H
# include
#endif

#include

#include "interface.h"
#include "support.h"
#include "interface.c"
#include "callbacks.c"


int
main (int argc, char *argv[])
{
GtkWidget *window;

#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif

gtk_set_locale ();
gtk_init (&argc, &argv);

add_pixmap_directory ("../pixmaps");

/*
* The following code was added by Glade to create one of each component
* (except popup menus), just so that you see something after building
* the project. Delete any components that you don't want shown initially.
*/
window = create_window ();
gtk_widget_show (window);

gtk_main ();
return 0;
}