Web Page - http://www.cs.tau.ac.il/~efif/courses/Software1_Summer_03
while (ptr != NULL) { free(ptr); ptr = ptr->next; } |
typedef struct node { struct node *right, *left; int value; } Node; |
/*! Print the tree pointed by root in ascending order */ void print_tree(Node *root) { if (!root) return; print_tree(root->left); printf("%d ", root->value); print_tree(root->right); } |
rbtree: Red_black_tree.o rbtree.o gcc $? -o $@ Red_black_tree.o: Red_black_tree.c Red_black_tree.h gcc -c $< -o $@ rbtree.o: rbtree.c Red_black_tree.h gcc -c $< -o $@ clean: rm -rf Red_black_tree.o rbtree.o rbtree |
bison -d x.y
' will make both x.tab.c
and x.tab.h
%.tab.c %.tab.h: %.y bison -d $< |
%.o : %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ |
x: y.o z.o |
rbtree: Red_black_tree.o rbtree.o Red_black_tree.o: Red_black_tree.h rbtree.o: Red_black_tree.h clean: rm -rf Red_black_tree.o rbtree.o rbtree |
CSOURCES = photo.c OBJECTS = $(CSOURCES:.c=.o) TARGET = photo CDEBUG = CFLAGS = -Wall -pedantic LDFLAGS = -lglut $(TARGET): $(OBJECTS) gcc $(OBJECTS) $(LDFLAGS) -o $@ %.o: %.c gcc $(CFLAGS) -c $< clean: rm -rf $(OBJECTS) $(TARGET) |
CSOURCES = cp_photo.c OBJECTS = $(CSOURCES:.c=.obj) TARGET = $(CSOURCES:.c=.exe) CDEBUG = CFLAGS = -nologo -I. -Iinclude CPPFLAGS = LDFLAGS = -nologo -subsystem:console -libpath:lib glut32.lib opengl32.lib $(TARGET): $(OBJECTS) link $(OBJECTS) $(LDFLAGS) -Out:$@ %.obj : %.c cl $(CFLAGS) -c $< clean: rm -rf $(OBJECTS) $(TARGET) |
CSOURCES = photo.c OBJECTS = $(CSOURCES:.c=.o) TARGET = photo CDEBUG = CFLAGS = -Wall -pedantic LDFLAGS = -lglut32 -lopengl32 $(TARGET): $(OBJECTS) gcc $(OBJECTS) $(LDFLAGS) -o $@ %.o: %.c gcc $(CFLAGS) -c $< clean: rm -rf $(OBJECTS) $(TARGET) |