Skip to content

Commit 2526835

Browse files
committed
Initial structure
Five daemons are planned for the initial version of the lightswitch: * lightsd - This daemon controls the actual lights and pushes data to fadecandy server. * stated - This daemon interacts with external sources of user input and coordinates the state of the system, the communication thereof and is hopefully the only service which will pass control sequences to lightsd * ambd - This daemon keeps track of ambient state of the default effect, including blueshift adjustments according to time of day and periodic light fluctuations just to keep things special. * switchd - This daemon takes input from the actual switch (knob) mounted on the wall and turns that into lighting changes. * webd - This daemon provides a web interface to the system and allows users to control the system via the web. We use a classic recursive Makefile with apologies to the late Peter Miller who sought to bring enlightenment to the heretics. However, for the current size of the project and expected level of complete separation betweeen the binaries involved, a recursive Makefile appears to be a somewhat reasonable approach. I anticipate I will regret this decision later. This commit also updates the .gitignore to appropriately ignore the binaries generated by the make sequence.
1 parent cfcb8fb commit 2526835

File tree

15 files changed

+122
-0
lines changed

15 files changed

+122
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
*.dylib
1616

1717
# Executables
18+
bin/*
19+
!bin/.gitignore
20+
lightsd/lightsd
21+
stated/stated
22+
ambd/ambd
23+
switchd/switchd
24+
webd/webd
1825
*.exe
1926
*.out
2027
*.app

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
subdirs := lightsd stated switchd ambd webd
2+
include Makefile.inc
3+
4+
.PHONY: $(subdirs)
5+
all: $(subdirs)
6+
7+
$(subdirs):
8+
$(MAKE) -C $@ all
9+
cp $@/$@ bin/$@
10+
11+
clean:
12+
for dir in $(subdirs); do \
13+
$(MAKE) -C $$dir clean; \
14+
done
15+
for exe in $(subdirs); do \
16+
rm bin/$$exe; \
17+
done

Makefile.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CC := gcc
2+
CFLAGS := -std=c99 -Wall -Wextra
3+
LDFLAGS :=

ambd/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
include ../Makefile.inc
2+
SRCS := ambd.c
3+
OBJS := $(SRCS:.c=.o)
4+
BIN := ambd
5+
LIBS :=
6+
7+
.PHONY: all
8+
all: ambd
9+
10+
ambd: $(OBJS)
11+
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
12+
13+
.PHONY: clean
14+
clean:
15+
rm ambd $(OBJS)

ambd/ambd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int main()
2+
{
3+
return 0;
4+
}

bin/.gitignore

Whitespace-only changes.

common/.gitignore

Whitespace-only changes.

lightsd/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
include ../Makefile.inc
2+
SRCS := lightsd.c
3+
OBJS := $(SRCS:.c=.o)
4+
BIN := lightsd
5+
LIBS :=
6+
7+
.PHONY: all
8+
all: lightsd
9+
10+
lightsd: $(OBJS)
11+
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
12+
13+
.PHONY: clean
14+
clean:
15+
rm lightsd $(OBJS)

lightsd/lightsd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int main()
2+
{
3+
return 0;
4+
}

stated/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
include ../Makefile.inc
2+
SRCS := stated.c
3+
OBJS := $(SRCS:.c=.o)
4+
BIN := stated
5+
LIBS :=
6+
7+
.PHONY: all
8+
all: stated
9+
10+
stated: $(OBJS)
11+
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
12+
13+
.PHONY: clean
14+
clean:
15+
rm stated $(OBJS)

0 commit comments

Comments
 (0)