Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved build process #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# the main binary
lifebar
core

# compiled but not linked objects
*.o
21 changes: 19 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# flags for $(CC)
CFLAGS=`pkg-config --cflags --libs x11 xft cairo` -lcurl -g
# a C compiler
CC=/usr/bin/gcc

all:
$(CC) $(CFLAGS) *.c -o lifebar
# variables for convenience
SOURCES=$(wildcard *.c)
OBJECTS=$(subst .c,.o,$(SOURCES))

# the main target
# only the linking is done here
lifebar: $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -o lifebar $(OBJECTS)

# pattern to compile every .c file to a .o file
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<

# removes files created by the compiler
.PHONY: clean
clean:
rm -f lifebar
rm -f *.o