Basic initializiation code

I print some messages to the screen and I have a makefile to compile
libsaria and gui code.
This commit is contained in:
Bryan Schumaker 2011-08-14 11:35:37 -04:00
parent b8e8f7179c
commit c0ace6fed6
8 changed files with 94 additions and 2 deletions

4
.gitignore vendored
View File

@ -1,3 +1,3 @@
*.pyc
*.o
*.swp
ocarina.py
ocarina

24
Makefile Normal file
View File

@ -0,0 +1,24 @@
export CC = g++
export CFLAGS = -Wall -Werror -g -O2
export INCLUDE = -I$(CURDIR)/include
#export LINK = `sdl-config --cflags --libs` -lSDL_image -lSDL_mixer `pkg-config --cflags --libs lua` -ldl
export BUILD = $(CC) $(CFLAGS) $(INCLUDE)
export SRCDIR = $(CURDIR)
DIRS = libsaria gui
CLEANDIRS = $(DIRS:%=clean-%)
.PHONY: all $(DIRS) clean $(CLEANDIRS)
all: $(DIRS)
$(BUILD) $(shell find . | grep "\.o$$") -o ocarina $(LINK)
$(DIRS):
$(MAKE) -f $(SRCDIR)/scripts/Makefile -C $@
clean: $(CLEANDIRS)
rm -f *.o a.out
$(CLEANDIRS):
$(MAKE) -f $(SRCDIR)/scripts/Makefile -C $(@:clean-%=%) clean

12
gui/ocarina.cpp Normal file
View File

@ -0,0 +1,12 @@
#include <iostream>
using namespace std;
#include <libsaria/libsaria.h>
int main()
{
print("Ocarina 5.0");
libsaria_init();
return 0;
}

View File

@ -0,0 +1,8 @@
#ifndef LIBSARIA_H
#define LIBSARIA_H
#include <libsaria/print.h>
void libsaria_init();
#endif /* LIBSARIA_H */

6
include/libsaria/print.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef LIBSARIA_PRINT
#define LIBSARIA_PRINT
void print(string item);
#endif /* LIBSARIA_PRINT */

10
libsaria/init.cpp Normal file
View File

@ -0,0 +1,10 @@
#include <iostream>
using namespace std;
#include <libsaria/libsaria.h>
void libsaria_init()
{
print("Initializing libsaria");
}

10
libsaria/print.cpp Normal file
View File

@ -0,0 +1,10 @@
#include <iostream>
using namespace std;
#include <libsaria/print.h>
void print(string item)
{
cout << item << endl;
}

22
scripts/Makefile Normal file
View File

@ -0,0 +1,22 @@
# Bryan Schumaker (4 / 1 / 2011)
DIRS = $(shell ls -l | grep '^d' | awk '{print $$9}')
FILES = $(shell ls *.cpp)
OBJS = $(FILES:%.cpp=%.o)
CLEANDIRS = $(DIRS:%=clean-%)
.PHONY: all $(DIRS) clean $(CLEANDIRS)
all:$(OBJS) $(DIRS)
%.o: %.cpp
$(BUILD) -c $*.cpp $(LINK)
$(DIRS):
$(MAKE) -f $(SRCDIR)/scripts/Makefile -C $@
clean: $(CLEANDIRS)
rm -f *.o
$(CLEANDIRS):
$(MAKE) -f $(SRCDIR)/scripts/Makefile -C $(@:clean-%=%) clean