Merge pull request #10 from maxwellgerber/master

More Makefile stuff
This commit is contained in:
Brian Barto 2016-04-29 11:26:24 -04:00
commit 9a7a77c2b7
7 changed files with 34 additions and 20 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
bin/*
obj/*

View File

@ -3,23 +3,42 @@ OBJ=obj
SRC=src SRC=src
CC = gcc CC = gcc
CFLAGS = -Wextra -Wall
LDLIBS = -lncurses LDLIBS = -lncurses
NCURSES_H = /usr/include/ncurses.h
UNAME = $(shell uname)
${BIN}/nms: ${OBJ}/nms.o ${OBJ}/main.o all: nms sneakers
$(CC) -o $@ $^ $(LDLIBS)
sneakers: ${OBJ}/nms.o ${OBJ}/sneakers.o nms: $(OBJ)/nms.o $(OBJ)/main.o | $(BIN)
$(CC) -o ${BIN}/$@ $^ $(LDLIBS) $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
${OBJ}/main.o: ${SRC}/main.c ${SRC}/nms.h sneakers: $(OBJ)/nms.o $(OBJ)/sneakers.o | $(BIN)
$(CC) -o $@ -c ${SRC}/main.c $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
${OBJ}/sneakers.o: ${SRC}/sneakers.c ${SRC}/nms.h $(OBJ)/%.o: $(SRC)/%.c | $(OBJ) $(NCURSES_H)
$(CC) -o $@ -c ${SRC}/sneakers.c $(CC) $(CFLAGS) -o $@ -c $<
${OBJ}/nms.o: ${SRC}/nms.c ${SRC}/nms.h $(BIN):
$(CC) -o $@ -c ${SRC}/nms.c mkdir $(BIN)
$(OBJ):
mkdir $(OBJ)
$(NCURSES_H):
ifeq ($(UNAME), Linux)
sudo apt-get update
sudo apt-get install ncurses-dev
endif
ifeq ($(UNAME), CentOS)
sudo yum update
sudo yum install ncurses-dev
endif
ifeq ($(UNAME), Fedora)
sudo dnf update --refresh
sudo dnf install ncurses-dev
endif
clean: clean:
rm -f ${BIN}/* rm -rf $(BIN)
rm -f $(OBJ)/* rm -rf $(OBJ)

2
bin/.gitignore vendored
View File

@ -1,2 +0,0 @@
*
!.gitignore

2
obj/.gitignore vendored
View File

@ -1,2 +0,0 @@
*
!.gitignore

1
src/.gitignore vendored
View File

@ -1 +0,0 @@
nms

View File

@ -65,7 +65,6 @@ char nms_exec(NmsArgs *args) {
int termSizeRows, termSizeCols; int termSizeRows, termSizeCols;
int c, n, x = 0, y = 0; int c, n, x = 0, y = 0;
int r_time, r_time_l, r_time_s; int r_time, r_time_l, r_time_s;
int ms, ls;
bool first = true; bool first = true;
char ret = 0; char ret = 0;

View File

@ -5,7 +5,7 @@
#include "nms.h" #include "nms.h"
int main(void) { int main(void) {
int l, termLines, termCols, spaces = 0; int termCols, spaces = 0;
char input; char input;
char display[2000]; char display[2000];
char *head1Left = "DATANET PROC RECORD: 45-3456-W-3452"; char *head1Left = "DATANET PROC RECORD: 45-3456-W-3452";
@ -27,7 +27,6 @@ int main(void) {
// Get terminal dimentions (needed for centering) // Get terminal dimentions (needed for centering)
struct winsize w; struct winsize w;
ioctl(0, TIOCGWINSZ, &w); ioctl(0, TIOCGWINSZ, &w);
termLines = w.ws_row;
termCols = w.ws_col; termCols = w.ws_col;
// Start building the display string // Start building the display string