OSDN Git Service

gui cui の分離と統合の設定を追加
authornaruko <naruko@24ea1065-a21e-4ca1-99c9-f5125deb0858>
Wed, 27 Oct 2010 23:23:49 +0000 (23:23 +0000)
committernaruko <naruko@24ea1065-a21e-4ca1-99c9-f5125deb0858>
Wed, 27 Oct 2010 23:23:49 +0000 (23:23 +0000)
git-svn-id: svn+ssh://svn.osdn.net/svnroot/unagi@377 24ea1065-a21e-4ca1-99c9-f5125deb0858

client/trunk/anago/Makefile.unix
client/trunk/anago/Makefile.windows
client/trunk/anago/Makefile.wx
client/trunk/anago/anago.mk
client/trunk/anago/anago_frame.cpp

index eabead0..480440a 100644 (file)
@@ -1,6 +1,8 @@
-TARGET = anago\r
+APP_CUI = \r
+APP_GUI = anago\r
 LIBUSB = \r
 SQUIRREL = ../SQUIRREL2\r
 KAZZO = ../../kazzo/firmware\r
+WX_CONFIG = wx-config\r
 \r
 include anago.mk\r
index db1d547..efa1e8f 100644 (file)
@@ -1,6 +1,8 @@
-TARGET = anago.exe\r
+APP_CUI = anago.exe\r
+APP_GUI = anago_wx.exe\r
 LIBUSB = d:/dev/LibUSB-Win32\r
 SQUIRREL = ../SQUIRREL2\r
 KAZZO = ../../kazzo/firmware\r
+WX_CONFIG = /d/dev/wxWidgets/build_release/wx-config\r
 \r
 include anago.mk\r
index 940f8e4..6b06b3a 100644 (file)
@@ -26,6 +26,7 @@ CXXFLAGS = -I.. `$(WX_CONFIG) --cppflags`
 \r
 #script_flash.o\r
 OBJ = anago_gui.o anago_frame.o\r
+#OBJ += anago_cui.o cui_gauge.o\r
 OBJ += header.o crc32.o file.o widget.o \\r
        script_program.o script_dump.o script_common.o \\r
        progress.o flash_device.o \\r
index bfad834..9b07e79 100644 (file)
@@ -1,29 +1,44 @@
-all: $(TARGET)
+all: $(APP_GUI) $(APP_CUI)
 VPATH = ..
 ifeq ($(RELEASE),1)
-  CFLAGS = -O2 -DNDEBUG
+  CPPFLAGS = -O2 -DNDEBUG
 else
-  CFLAGS = -g -O0
+  CPPFLAGS = -g -O0
 endif
-CFLAGS += -Wall -Werror -DDEBUG=1 -DANAGO=1
-CFLAGS += -I.. -I$(SQUIRREL)/include -I$(KAZZO)
+CPPFLAGS += -Wall -Werror -DDEBUG=1 -DANAGO=1
+CFLAGS = -I.. -I$(SQUIRREL)/include -I$(KAZZO)
 ifneq ($(strip $(LIBUSB)),)
   CFLAGS += -I$(LIBUSB)/include
 endif
+CXXFLAGS = -I.. `$(WX_CONFIG) --cppflags`
+
 LDFLAG = -L$(SQUIRREL)/lib
 ifneq ($(strip $(LIBUSB)),)
   LDFLAG += -L$(LIBUSB)/lib/gcc 
 endif
 CC = gcc
-OBJ = anago_cui.o header.o crc32.o file.o widget.o cui_gauge.o \
+
+OBJ_CUI = anago_cui.o cui_gauge.o
+OBJ_GUI = anago_gui.o anago_frame.o
+OBJ_CORE = header.o crc32.o file.o widget.o \
        script_program.o script_dump.o script_common.o \
        progress.o flash_device.o \
        reader_kazzo.o usb_device.o squirrel_wrap.o memory_manage.o
 
+ifneq ($(strip $(APP_CUI)),)
+       OBJ_CUI += $(OBJ_CORE)
+       OBJ_GUI += $(OBJ_CORE)
+else
+       OBJ_GUI += $(OBJ_CUI)
+       OBJ_GUI += $(OBJ_CORE)
+endif
+
+$(APP_GUI): $(OBJ_GUI) 
+       g++ -o $@ $(LDFLAG) $(OBJ_GUI) `$(WX_CONFIG) --libs core` -lusb -lsqstdlib -lsquirrel
+$(APP_CUI): $(OBJ_CUI) 
+       g++ -o $@ $(LDFLAG) $(OBJ_CUI) -lusb -lsqstdlib -lsquirrel
 clean:
-       rm -f $(OBJ)
-$(TARGET): $(OBJ) 
-       g++ -o $@ $(LDFLAG) $(OBJ) -lusb -lsqstdlib -lsquirrel
+       rm -f $(OBJ_CUI) $(OBJ_GUI) $(OBJ_CORE)
 
 script_flash.o: squirrel_wrap.h
 script_dump.o: squirrel_wrap.h
index 96ed09a..a1b99a7 100644 (file)
@@ -536,6 +536,19 @@ void *anago_programmer::Entry(void)
        return NULL;
 }
 
+#ifndef WIN32
+extern "C"{
+       int anago_cui(int c, char **v);
+}
+int main(int c, char **v)
+{
+       if(c < 2){
+               return wxEntry(c, v);
+       }
+       return anago_cui(c, v);
+}
+#endif
+
 class MyApp : public wxApp
 {
 private:
@@ -550,3 +563,4 @@ public:
        }
 };
 IMPLEMENT_APP(MyApp)
+