changeset 84:3d1c71fbd4a4

add bitInfo & fix Makefile
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Wed, 07 Oct 2015 18:21:32 +0900
parents d19afac949a5
children 5072a44ed842
files c/bitVector/Makefile c/bitVector/bitInfo.h c/bitVector/main.cc
diffstat 3 files changed, 25 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/c/bitVector/Makefile	Wed Oct 07 18:17:56 2015 +0900
+++ b/c/bitVector/Makefile	Wed Oct 07 18:21:32 2015 +0900
@@ -1,12 +1,27 @@
 TARGET= bitVector
-OPTION= -Wall -O0 -g
+CFLAGS= -Wall -O0 -g
+CC= clang++
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+.SUFFIXES: .cc .o
 
-$(TARGET):main.cc
-	clang $(OPTION) -o $(TARGET) main.cc
+.cc.o:
+	$(CC) $(CFLAGS) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET):$(OBJS)
+	$(CC) -o $@ $(OBJS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
 
 clean:
-	rm -f $(TARGET)
-	rm -r $(TARGET).dSYM
+	rm -f $(TARGET) $(OBJS)
 	rm -f *~ \#*
 
 test:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c/bitVector/bitInfo.h	Wed Oct 07 18:21:32 2015 +0900
@@ -0,0 +1,4 @@
+typedef struct bitInfo {
+    int arrayNum;
+    unsigned long *bitContainer;
+}BitInfo,*BitInfoPtr;
--- a/c/bitVector/main.cc	Wed Oct 07 18:17:56 2015 +0900
+++ b/c/bitVector/main.cc	Wed Oct 07 18:21:32 2015 +0900
@@ -1,14 +1,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "bitInfo.h"
 
 int bitBlock = sizeof(unsigned long) * 8;
 
-typedef struct bitInfo {
-    int arrayNum;
-    unsigned long *bitContainer;
-}BitInfo,*BitInfoPtr;
-
 void bitSet(BitInfoPtr bi, int bitSetPosition) {
 
     unsigned long tmp = 1;