#========================================================================= # # MAKE FILE FOR ROCKY # # #========================================================================= SHELL = /usr/bin/sh VERSION = 0.1 DATE = `date '+%Y-%m-%d'` PACKAGE = ROCKY #---------------PATH INFO-------------------- LBIN = bin LOBJ = obj LSRC = src #-------------------------------------------- #----------- COMPILING INFOMATION------------- CC = gcc EXE = ROCKY CDUBG = CFLAGS = -Wall -g -o # CFLAS = -Wall -Wextra -O2 LIBS = ALLFILES= $(wildcard $(LSRC)/*.c) # OBJS OBJS = $(ALLFILES:%.c=%.o) #---------------------------------------------- #PHONY all: dirs $(EXE) info info: -@echo $(EXE) $(VERSION) IS BUILDING... ${EXE}: $(OBJS) $(CC) $(CFLAGS) $@ $(OBJS) dirs: -@mkdir -p $(LBIN) $(LOBJ) clean: -@rm $(PACKAGE) -@rm -rf $(LBIN) $(LOBJ) -@rm $(LSRC)/*.o $(OBJS):%.o:%.c $(CC) -c $< -o $@ .PHONY: clean
/*======================================================================== *========================================================================*/ #include <getopt.h> #include <stdio.h> #include <stdlib.h> #include "argument.h" void args_handle(int argc, char* argv[]) { static struct option rocky_opt[]={ {"help", no_argument, NULL, 'h'}, {"license", no_argument, NULL, 'l'} }; int option_index=0; int c=0; while(c!= EOF) { c = getopt_long(argc, argv, "hl", rocky_opt, &option_index); switch(c) { case 'h': printf("help info"); exit(EXIT_SUCCESS); break; case 'l': printf("liecense info"); exit(EXIT_SUCCESS); break; default: printf("default"); exit(EXIT_SUCCESS); break; } } }