forked from iicd/git-learner
		
	Hello world initilized
This commit is contained in:
		
							
								
								
									
										27
									
								
								src/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| OBJECTS = main.o | ||||
| TARGET = hello | ||||
|  | ||||
| all: $(TARGET) | ||||
|  | ||||
| $(TARGET): $(OBJECTS) | ||||
| 	$(CC) -o $@ $^ | ||||
|  | ||||
| main.o: | new_header | ||||
| main.o: version.h | ||||
|  | ||||
| new_header: | ||||
| 	@sed -e "s/<version>/$$(git describe)/g" \ | ||||
| 		<version.h.in> version.h.tmp | ||||
| 	@if diff -q version.h.tmp version.h > /dev/null 2>&1; \ | ||||
| 		then \ | ||||
| 			rm version.h.tmp; \ | ||||
| 		else \ | ||||
| 			echo "version.h.in => version.h" ; \ | ||||
| 			mv version.h.tmp version.h;\ | ||||
| 		fi | ||||
|  | ||||
| clean: | ||||
| 	rm -f $(TARGET) $(OBJECTS) version.h | ||||
|  | ||||
| .PHONY: all clean | ||||
|  | ||||
							
								
								
									
										8
									
								
								src/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| #include "version.h" | ||||
| #include <stdio.h> | ||||
|  | ||||
| int main(){ | ||||
| 	printf("Hello, world. \n"); | ||||
| 	printf("version: %s. \n", _VERSION); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										6
									
								
								src/version.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/version.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| #ifndef HELLO_WORLD_VERSION_H | ||||
| #define HELLO_WORLD_VERSION_H | ||||
|  | ||||
| #define _VERSION "old_practise" | ||||
|  | ||||
| #endif | ||||
		Reference in New Issue
	
	Block a user