summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@gnome.org>2011-09-02 16:05:13 +0100
committerAlberto Ruiz <aruiz@gnome.org>2011-09-02 16:05:13 +0100
commitaf73bdc18bd9b53d79254f2aa5bd70eb5b6d975b (patch)
tree5dd0f6f35e42ed86a6bbf2483472151a428deacb
parent0a30b08dbfdf87b45cb29dbed8a46224637ed6d2 (diff)
downloadtbdiff-af73bdc18bd9b53d79254f2aa5bd70eb5b6d975b.tar.gz
Make output file name parametric. Add install/uninstall option to Makefile.
-rw-r--r--Makefile9
-rw-r--r--create.c20
2 files changed, 18 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index f7b2c98..e2c34d2 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,14 @@ ifeq (,$(findstring clean,$(MAKECMDGOALS)))
-include $(patsubst %.c,%.d,$(SHARED_SRC) $(DEPLOY_SRC) $(CREATE_SRC))
endif
+install: otap_create otap_deploy
+ install otap_create /usr/local/bin
+ install otap_deploy /usr/local/bin
+
+uninstall:
+ rm -rf /usr/local/bin/otap_create
+ rm -rf /usr/local/bin/otap_crate
+
.PHONY: clean
clean:
rm -f otap_deploy otap_create *.o *.d
-
diff --git a/create.c b/create.c
index d231491..be4d324 100644
--- a/create.c
+++ b/create.c
@@ -9,8 +9,8 @@
int main(int argc, char** argv) {
- if(argc < 3) {
- fprintf(stderr, "Error: Need to designate 2 trees to difference.\n");
+ if(argc < 4) {
+ fprintf(stderr, "Usage: %s OUTPUT SOURCE_DIR TARGET_DIR.\n", argv[0]);
return EXIT_FAILURE;
}
@@ -21,31 +21,31 @@ int main(int argc, char** argv) {
otap_stat_t* tstat[2];
- tstat[0] = otap_stat(argv[1]);
+ tstat[0] = otap_stat(argv[2]);
if(tstat[0] == NULL) {
- fprintf(stderr, "Error: Unable to stat '%s'.\n", argv[1]);
+ fprintf(stderr, "Error: Unable to stat '%s'.\n", argv[2]);
return EXIT_FAILURE;
}
if (chdir(cwd_buff) != 0) {
fprintf(stderr, "Error: Unable to return to '%s'.\n", cwd_buff);
return EXIT_FAILURE;
- }
+ }
- tstat[1] = otap_stat(argv[2]);
+ tstat[1] = otap_stat(argv[3]);
if(tstat[1] == NULL) {
- fprintf(stderr, "Error: Unable to stat '%s'.\n", argv[2]);
+ fprintf(stderr, "Error: Unable to stat '%s'.\n", argv[3]);
return EXIT_FAILURE;
}
if (chdir(cwd_buff) != 0) {
fprintf(stderr, "Error: Unable to return to '%s'.\n", cwd_buff);
return EXIT_FAILURE;
- }
+ }
- FILE* fp = fopen("patch.otap", "wb");
+ FILE* fp = fopen(argv[1], "wb");
if(fp == NULL) {
- fprintf(stderr, "Error: Unable to open patch for writing.\n");
+ fprintf(stderr, "ERROR: Unable to open patch for writing.\n");
return EXIT_FAILURE;
}