Fix help option and remove linker option from makefile
This commit is contained in:
8
Makefile
8
Makefile
@@ -4,16 +4,16 @@ LDFLAGS=-lm
|
|||||||
PREFIX= /usr/local
|
PREFIX= /usr/local
|
||||||
|
|
||||||
opt-pricer : src/opt-pricer.c gbm.o black_scholes.o utils.o
|
opt-pricer : src/opt-pricer.c gbm.o black_scholes.o utils.o
|
||||||
@$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
@$(CC) $(CFLAGS) $^ -o $@
|
||||||
|
|
||||||
gbm.o : src/gbm_mc.c
|
gbm.o : src/gbm_mc.c
|
||||||
@$(CC) $(CFLAGS) -c $^ $(LDFLAGS) -o $@
|
@$(CC) $(CFLAGS) -c $^ -o $@
|
||||||
|
|
||||||
black_scholes.o : src/black_scholes.c
|
black_scholes.o : src/black_scholes.c
|
||||||
@$(CC) $(CFLAGS) -c $^ $(LDFLAGS) -o $@
|
@$(CC) $(CFLAGS) -c $^ -o $@
|
||||||
|
|
||||||
utils.o : src/utils.c
|
utils.o : src/utils.c
|
||||||
@$(CC) $(CFLAGS) -c $^ $(LDFLAGS) -o $@
|
@$(CC) $(CFLAGS) -c $^ -o $@
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install : opt-pricer
|
install : opt-pricer
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ static struct helptext options[] = {
|
|||||||
"Call flag"},
|
"Call flag"},
|
||||||
{"-p, --put",
|
{"-p, --put",
|
||||||
"Put or call flag"},
|
"Put or call flag"},
|
||||||
{"-h",
|
{"-h, --help",
|
||||||
"This help text"},
|
"This help text"},
|
||||||
{ NULL , NULL }
|
{ NULL , NULL }
|
||||||
};
|
};
|
||||||
@@ -49,6 +49,7 @@ static struct option long_options[] = {
|
|||||||
{"expiry-date", required_argument, 0, 'e'},
|
{"expiry-date", required_argument, 0, 'e'},
|
||||||
{"call", no_argument, 0, 'c'},
|
{"call", no_argument, 0, 'c'},
|
||||||
{"put", no_argument, 0, 'p'},
|
{"put", no_argument, 0, 'p'},
|
||||||
|
{"help", no_argument, 0, 'h'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ int main(int argc, char *argv[])
|
|||||||
memset(&expiry, 0, sizeof(expiry));
|
memset(&expiry, 0, sizeof(expiry));
|
||||||
memset(&value, 0, sizeof(value));
|
memset(&value, 0, sizeof(value));
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv, "s:k:r:v:d:e:N:cp", long_options, &option_index)) != -1) {
|
while ((opt = getopt_long(argc, argv, "s:k:r:v:d:e:N:cp:h", long_options, &option_index)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 's':
|
case 's':
|
||||||
if (sscanf(optarg, "%lf", &spot) == EOF) {
|
if (sscanf(optarg, "%lf", &spot) == EOF) {
|
||||||
|
|||||||
Reference in New Issue
Block a user